Class: BrainzLab::Pulse::Propagation::Context
- Inherits:
-
Object
- Object
- BrainzLab::Pulse::Propagation::Context
- Defined in:
- lib/brainzlab/pulse/propagation.rb
Instance Attribute Summary collapse
-
#parent_span_id ⇒ Object
Returns the value of attribute parent_span_id.
-
#sampled ⇒ Object
Returns the value of attribute sampled.
-
#span_id ⇒ Object
Returns the value of attribute span_id.
-
#trace_id ⇒ Object
Returns the value of attribute trace_id.
-
#tracestate ⇒ Object
Returns the value of attribute tracestate.
Instance Method Summary collapse
-
#initialize(trace_id: nil, span_id: nil, parent_span_id: nil, sampled: true, tracestate: nil) ⇒ Context
constructor
A new instance of Context.
- #to_h ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(trace_id: nil, span_id: nil, parent_span_id: nil, sampled: true, tracestate: nil) ⇒ Context
Returns a new instance of Context.
25 26 27 28 29 30 31 |
# File 'lib/brainzlab/pulse/propagation.rb', line 25 def initialize(trace_id: nil, span_id: nil, parent_span_id: nil, sampled: true, tracestate: nil) @trace_id = trace_id || generate_trace_id @span_id = span_id || generate_span_id @parent_span_id = parent_span_id @sampled = sampled @tracestate = tracestate end |
Instance Attribute Details
#parent_span_id ⇒ Object
Returns the value of attribute parent_span_id.
23 24 25 |
# File 'lib/brainzlab/pulse/propagation.rb', line 23 def parent_span_id @parent_span_id end |
#sampled ⇒ Object
Returns the value of attribute sampled.
23 24 25 |
# File 'lib/brainzlab/pulse/propagation.rb', line 23 def sampled @sampled end |
#span_id ⇒ Object
Returns the value of attribute span_id.
23 24 25 |
# File 'lib/brainzlab/pulse/propagation.rb', line 23 def span_id @span_id end |
#trace_id ⇒ Object
Returns the value of attribute trace_id.
23 24 25 |
# File 'lib/brainzlab/pulse/propagation.rb', line 23 def trace_id @trace_id end |
#tracestate ⇒ Object
Returns the value of attribute tracestate.
23 24 25 |
# File 'lib/brainzlab/pulse/propagation.rb', line 23 def tracestate @tracestate end |
Instance Method Details
#to_h ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/brainzlab/pulse/propagation.rb', line 37 def to_h { trace_id: @trace_id, span_id: @span_id, parent_span_id: @parent_span_id, sampled: @sampled, tracestate: @tracestate }.compact end |
#valid? ⇒ Boolean
33 34 35 |
# File 'lib/brainzlab/pulse/propagation.rb', line 33 def valid? !trace_id.nil? && !span_id.nil? end |