Class: Honeycomb::Trace
- Inherits:
-
Object
- Object
- Honeycomb::Trace
- Extended by:
- Forwardable
- Includes:
- RollupFields
- Defined in:
- lib/honeycomb/trace.rb
Overview
Represents a Honeycomb trace, which groups spans together
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#root_span ⇒ Object
readonly
Returns the value of attribute root_span.
Instance Method Summary collapse
- #add_field(key, value) ⇒ Object
-
#initialize(builder:, context:, serialized_trace: nil, **options) ⇒ Trace
constructor
A new instance of Trace.
Methods included from RollupFields
#add_rollup_field, #rollup_fields
Constructor Details
#initialize(builder:, context:, serialized_trace: nil, **options) ⇒ Trace
Returns a new instance of Trace.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/honeycomb/trace.rb', line 19 def initialize(builder:, context:, serialized_trace: nil, **) trace_id, parent_span_id, trace_fields, dataset = internal_parse(context: context, serialized_trace: serialized_trace, **) # if dataset is not nil, # set trace's builder.dataset = dataset from trace header if context.classic? dataset && builder.dataset = dataset end @id = trace_id || generate_trace_id @fields = trace_fields || {} @root_span = Span.new(trace: self, parent_id: parent_span_id, is_root: true, builder: builder, context: context, **) end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
17 18 19 |
# File 'lib/honeycomb/trace.rb', line 17 def fields @fields end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
17 18 19 |
# File 'lib/honeycomb/trace.rb', line 17 def id @id end |
#root_span ⇒ Object (readonly)
Returns the value of attribute root_span.
17 18 19 |
# File 'lib/honeycomb/trace.rb', line 17 def root_span @root_span end |
Instance Method Details
#add_field(key, value) ⇒ Object
39 40 41 |
# File 'lib/honeycomb/trace.rb', line 39 def add_field(key, value) @fields[key] = value end |