Class: MicroscopeTracer::Span
- Inherits:
-
Object
- Object
- MicroscopeTracer::Span
- Defined in:
- lib/microscope_tracer/span.rb
Instance Attribute Summary collapse
-
#parent_span_id ⇒ Object
readonly
Returns the value of attribute parent_span_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_span_id, span_id) ⇒ Span
constructor
A new instance of Span.
- #store_for_this_request ⇒ Object
Constructor Details
#initialize(trace_id, parent_span_id, span_id) ⇒ Span
Returns a new instance of Span.
20 21 22 23 24 |
# File 'lib/microscope_tracer/span.rb', line 20 def initialize(trace_id,parent_span_id,span_id) trace_id ||= Span.generate_unique_id span_id ||= Span.generate_unique_id @trace_id, @parent_span_id, @span_id = trace_id, parent_span_id, span_id end |
Instance Attribute Details
#parent_span_id ⇒ Object (readonly)
Returns the value of attribute parent_span_id.
6 7 8 |
# File 'lib/microscope_tracer/span.rb', line 6 def parent_span_id @parent_span_id end |
#span_id ⇒ Object (readonly)
Returns the value of attribute span_id.
6 7 8 |
# File 'lib/microscope_tracer/span.rb', line 6 def span_id @span_id end |
#trace_id ⇒ Object (readonly)
Returns the value of attribute trace_id.
6 7 8 |
# File 'lib/microscope_tracer/span.rb', line 6 def trace_id @trace_id end |
Class Method Details
.generate_unique_id ⇒ Object
8 9 10 |
# File 'lib/microscope_tracer/span.rb', line 8 def self.generate_unique_id SecureRandom.uuid end |
.lookup_for_this_request ⇒ Object
12 13 14 |
# File 'lib/microscope_tracer/span.rb', line 12 def self.lookup_for_this_request RequestStore.store[:microscope_span] end |
Instance Method Details
#store_for_this_request ⇒ Object
16 17 18 |
# File 'lib/microscope_tracer/span.rb', line 16 def store_for_this_request RequestStore.store[:microscope_span] = self end |