Class: LightStep::SpanContext

Inherits:
Object
  • Object
show all
Defined in:
lib/lightstep/span_context.rb

Overview

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

Constant Summary collapse

ZERO_PADDING =
'0' * 16

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, trace_id:, sampled: true, baggage: {}) ⇒ SpanContext

Returns a new instance of SpanContext.



11
12
13
14
15
16
17
# File 'lib/lightstep/span_context.rb', line 11

def initialize(id:, trace_id:, sampled: true, baggage: {})
  @id = id.freeze
  @trace_id16 = pad_id(trace_id).freeze
  @trace_id = truncate_id(trace_id).freeze
  @sampled = sampled
  @baggage = baggage.freeze
end

Instance Attribute Details

#baggageObject (readonly)

Returns the value of attribute baggage.



6
7
8
# File 'lib/lightstep/span_context.rb', line 6

def baggage
  @baggage
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/lightstep/span_context.rb', line 6

def id
  @id
end

#sampledObject (readonly) Also known as: sampled?

Returns the value of attribute sampled.



6
7
8
# File 'lib/lightstep/span_context.rb', line 6

def sampled
  @sampled
end

#trace_idObject (readonly)

Returns the value of attribute trace_id.



6
7
8
# File 'lib/lightstep/span_context.rb', line 6

def trace_id
  @trace_id
end

#trace_id16Object (readonly)

Returns the value of attribute trace_id16.



6
7
8
# File 'lib/lightstep/span_context.rb', line 6

def trace_id16
  @trace_id16
end