Class: Logasm::Tracer::SpanContext
- Inherits:
-
Object
- Object
- Logasm::Tracer::SpanContext
- Defined in:
- lib/logasm/tracer/span_context.rb
Overview
SpanContext holds the data for a span that gets inherited to child spans
Instance Attribute Summary collapse
-
#baggage ⇒ Object
readonly
Returns the value of attribute baggage.
-
#parent_id ⇒ Object
readonly
Returns the value of attribute parent_id.
-
#span_id ⇒ Object
readonly
Returns the value of attribute span_id.
-
#trace_id ⇒ Object
readonly
Returns the value of attribute trace_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(trace_id:, parent_id: nil, span_id:, baggage: {}) ⇒ SpanContext
constructor
A new instance of SpanContext.
Constructor Details
#initialize(trace_id:, parent_id: nil, span_id:, baggage: {}) ⇒ SpanContext
20 21 22 23 24 25 |
# File 'lib/logasm/tracer/span_context.rb', line 20 def initialize(trace_id:, parent_id: nil, span_id:, baggage: {}) @span_id = span_id @parent_id = parent_id @trace_id = trace_id @baggage = baggage end |
Instance Attribute Details
#baggage ⇒ Object (readonly)
Returns the value of attribute baggage.
18 19 20 |
# File 'lib/logasm/tracer/span_context.rb', line 18 def baggage @baggage end |
#parent_id ⇒ Object (readonly)
Returns the value of attribute parent_id.
18 19 20 |
# File 'lib/logasm/tracer/span_context.rb', line 18 def parent_id @parent_id end |
#span_id ⇒ Object (readonly)
Returns the value of attribute span_id.
18 19 20 |
# File 'lib/logasm/tracer/span_context.rb', line 18 def span_id @span_id end |
#trace_id ⇒ Object (readonly)
Returns the value of attribute trace_id.
18 19 20 |
# File 'lib/logasm/tracer/span_context.rb', line 18 def trace_id @trace_id end |
Class Method Details
.create_from_parent_context(span_context) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/logasm/tracer/span_context.rb', line 11 def self.create_from_parent_context(span_context) trace_id = span_context.trace_id parent_id = span_context.span_id span_id = TraceId.generate new(span_id: span_id, parent_id: parent_id, trace_id: trace_id) end |
.create_parent_context ⇒ Object
5 6 7 8 9 |
# File 'lib/logasm/tracer/span_context.rb', line 5 def self.create_parent_context trace_id = TraceId.generate span_id = TraceId.generate new(trace_id: trace_id, span_id: span_id) end |