Method: LHC::Zipkin#before_request

Defined in:
lib/lhc/interceptors/zipkin.rb

#before_requestObject



13
14
15
16
17
18
19
20
21
# File 'lib/lhc/interceptors/zipkin.rb', line 13

def before_request
  return unless dependencies?
  ZipkinTracer::TraceContainer.with_trace_id(trace_id) do
    # add headers even if the current trace_id should not be sampled
    B3_HEADERS.each { |method, header| request.headers[header] = trace_id.send(method).to_s }
    # only sample the current call if we're instructed to do so
    start_trace! if ::Trace.tracer && trace_id.sampled?
  end
end