class Test::SpanContext

Attributes

parent_span_id[R]
span_id[R]
trace_id[R]

Public Class Methods

child_of(parent_context) click to toggle source
# File lib/test/span_context.rb, line 9
def child_of(parent_context)
  new(trace_id: parent_context.trace_id,
      span_id: IdProvider.generate,
      parent_span_id: parent_context.span_id,
      baggage: parent_context.baggage)
end
new(trace_id:, span_id:, parent_span_id: nil, baggage: {}) click to toggle source
Calls superclass method
# File lib/test/span_context.rb, line 21
def initialize(trace_id:, span_id:, parent_span_id: nil, baggage: {})
  Type! trace_id, String
  Type! span_id, String
  Type! parent_span_id, String, NilClass
  Type! baggage, Hash

  super(baggage: baggage)

  @trace_id = trace_id
  @span_id = span_id
  @parent_span_id = parent_span_id
  @baggage = baggage
end
root() click to toggle source
# File lib/test/span_context.rb, line 4
def root
  new(trace_id: IdProvider.generate,
      span_id: IdProvider.generate)
end

Public Instance Methods

==(rhs) click to toggle source
# File lib/test/span_context.rb, line 39
def ==(rhs)
  self.class == rhs.class &&
    trace_id == rhs.trace_id &&
    span_id == rhs.span_id &&
    parent_span_id == rhs.parent_span_id &&
    baggage == rhs.baggage
end
to_s() click to toggle source
# File lib/test/span_context.rb, line 35
def to_s
  "SpanContext(trace_id=#{trace_id}, span_id=#{span_id}, parent_span_id=#{parent_span_id}, baggage=#{baggage})"
end