Class: BaselineRedRpm::Tracing::SpanContext
- Inherits:
-
Object
- Object
- BaselineRedRpm::Tracing::SpanContext
- Defined in:
- lib/baseline_red_rpm/tracing/span_context.rb
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
- #get_baggage_item(key) ⇒ Object
-
#initialize(opts = {}) ⇒ SpanContext
constructor
A new instance of SpanContext.
- #sampled? ⇒ Boolean
- #set_baggage_item(key, value) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ SpanContext
Returns a new instance of SpanContext.
22 23 24 25 26 27 28 |
# File 'lib/baseline_red_rpm/tracing/span_context.rb', line 22 def initialize(opts = {}) @span_id = opts[:span_id] || nil @parent_id = opts[:parent_id] || nil @trace_id = opts[:trace_id] || nil @sampled = opts[:sampled] || nil @baggage = opts[:baggage] || {} end |
Instance Attribute Details
#baggage ⇒ Object (readonly)
Returns the value of attribute baggage.
20 21 22 |
# File 'lib/baseline_red_rpm/tracing/span_context.rb', line 20 def baggage @baggage end |
#parent_id ⇒ Object (readonly)
Returns the value of attribute parent_id.
20 21 22 |
# File 'lib/baseline_red_rpm/tracing/span_context.rb', line 20 def parent_id @parent_id end |
#span_id ⇒ Object (readonly)
Returns the value of attribute span_id.
20 21 22 |
# File 'lib/baseline_red_rpm/tracing/span_context.rb', line 20 def span_id @span_id end |
#trace_id ⇒ Object (readonly)
Returns the value of attribute trace_id.
20 21 22 |
# File 'lib/baseline_red_rpm/tracing/span_context.rb', line 20 def trace_id @trace_id end |
Class Method Details
.create_from_parent_context(span_context) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/baseline_red_rpm/tracing/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, sampled: span_context.sampled? ) end |
Instance Method Details
#get_baggage_item(key) ⇒ Object
34 35 36 |
# File 'lib/baseline_red_rpm/tracing/span_context.rb', line 34 def get_baggage_item(key) baggage[key] end |
#sampled? ⇒ Boolean
38 39 40 |
# File 'lib/baseline_red_rpm/tracing/span_context.rb', line 38 def sampled? @sampled end |
#set_baggage_item(key, value) ⇒ Object
30 31 32 |
# File 'lib/baseline_red_rpm/tracing/span_context.rb', line 30 def set_baggage_item(key, value) baggage[key] = value end |