class Gruf::Lightstep::ClientInterceptor
Intercepts outbound calls to provide LightStep tracing
Public Instance Methods
call(request_context:) { || ... }
click to toggle source
# File lib/gruf/lightstep/client_interceptor.rb, line 24 def call(request_context:) span = active_span if span span_data = span.to_h logger.debug "[gruf-lightstep] Injecting current active span #{span_data[:span_guid]} into outbound request context for #{request_context.method_name}" request_context.metadata['ot-tracer-spanid'] = span_data[:span_guid].to_s request_context.metadata['ot-tracer-traceid'] = span_data[:trace_guid].to_s request_context.metadata['ot-tracer-sampled'] = '1' end yield end
Private Instance Methods
active_span()
click to toggle source
@return [::LightStep::Span|NilClass]
# File lib/gruf/lightstep/client_interceptor.rb, line 42 def active_span tracer = ::Bigcommerce::Lightstep::Tracer.instance return unless tracer span = tracer.active_span return unless span.is_a?(::LightStep::Span) span end