class OpenTracingTestTracer::SpanContext

SpanContext holds the data for a span that gets inherited to child spans

Attributes

baggage[R]
parent_id[R]
span_id[R]
trace_id[R]

Public Class Methods

create_from_parent_context(span_context) click to toggle source
# File lib/opentracing_test_tracer/span_context.rb, line 11
def self.create_from_parent_context(span_context)
  new(
    span_id: TraceId.generate,
    parent_id: span_context.span_id,
    trace_id: span_context.trace_id
  )
end
create_parent_context() click to toggle source
# File lib/opentracing_test_tracer/span_context.rb, line 6
def self.create_parent_context
  trace_id = TraceId.generate
  new(trace_id: trace_id, span_id: trace_id)
end
new(span_id:, parent_id: nil, trace_id:, baggage: {}) click to toggle source
# File lib/opentracing_test_tracer/span_context.rb, line 21
def initialize(span_id:, parent_id: nil, trace_id:, baggage: {})
  @span_id = span_id
  @parent_id = parent_id
  @trace_id = trace_id
  @baggage = baggage
end

Public Instance Methods

to_s() click to toggle source
# File lib/opentracing_test_tracer/span_context.rb, line 28
def to_s
  "SpanContext(trace_id=#{@trace_id}, " \
    "span_id=#{@span_id}, " \
    "parent_id=#{@parent_id}, " \
    "baggage=#{@baggage})"
end