class ElasticAPM::OpenTracing::SpanContext

@api private

Attributes

trace_context[RW]

Public Class Methods

from_header(header) click to toggle source
# File lib/elastic_apm/opentracing.rb, line 129
def self.from_header(header)
  return unless header

  trace_context = TraceContext.new(
    traceparent: TraceContext::Traceparent.parse(header)
  )

  trace_context.traceparent.id = trace_context.parent_id
  trace_context.traceparent.parent_id = nil

  from_trace_context(trace_context)
end
from_trace_context(trace_context) click to toggle source
# File lib/elastic_apm/opentracing.rb, line 142
def self.from_trace_context(trace_context)
  new(trace_context: trace_context)
end
new(trace_context:, baggage: nil) click to toggle source
# File lib/elastic_apm/opentracing.rb, line 115
def initialize(trace_context:, baggage: nil)
  if baggage
    ElasticAPM.agent.config.logger.warn(
      'Baggage is not supported by ElasticAPM'
    )
  end

  @trace_context = trace_context
end

Public Instance Methods

child() click to toggle source
# File lib/elastic_apm/opentracing.rb, line 146
def child
  self.class.from_trace_context(trace_context.child)
end