Class: Maze::Api::Model::Span
- Inherits:
-
Object
- Object
- Maze::Api::Model::Span
- Defined in:
- lib/maze/api/model/span.rb
Overview
A single OTEL span.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#end_time ⇒ Object
Returns the value of attribute end_time.
-
#id ⇒ Object
Returns the value of attribute id.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#name ⇒ Object
Returns the value of attribute name.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
-
#trace_id ⇒ Object
Returns the value of attribute trace_id.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Span
Create a Span from a hash.
Instance Method Summary collapse
- #add_attribute(attribute) ⇒ Object
-
#initialize ⇒ Span
constructor
A new instance of Span.
Constructor Details
#initialize ⇒ Span
Returns a new instance of Span.
12 13 14 15 16 17 18 |
# File 'lib/maze/api/model/span.rb', line 12 def initialize @attributes = {} def add_attribute(attribute) @attributes[attribute.key] = attribute end end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
10 11 12 |
# File 'lib/maze/api/model/span.rb', line 10 def attributes @attributes end |
#end_time ⇒ Object
Returns the value of attribute end_time.
10 11 12 |
# File 'lib/maze/api/model/span.rb', line 10 def end_time @end_time end |
#id ⇒ Object
Returns the value of attribute id.
10 11 12 |
# File 'lib/maze/api/model/span.rb', line 10 def id @id end |
#kind ⇒ Object
Returns the value of attribute kind.
10 11 12 |
# File 'lib/maze/api/model/span.rb', line 10 def kind @kind end |
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/maze/api/model/span.rb', line 10 def name @name end |
#start_time ⇒ Object
Returns the value of attribute start_time.
10 11 12 |
# File 'lib/maze/api/model/span.rb', line 10 def start_time @start_time end |
#trace_id ⇒ Object
Returns the value of attribute trace_id.
10 11 12 |
# File 'lib/maze/api/model/span.rb', line 10 def trace_id @trace_id end |
Class Method Details
.from_hash(hash) ⇒ Span
Create a Span from a hash.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/maze/api/model/span.rb', line 24 def from_hash(hash) span = new span.id = hash['spanId'] span.kind = hash['kind'] span.name = hash['name'] span.trace_id = hash['traceId'] span.start_time = hash['startTimeUnixNano'] span.end_time = hash['endTimeUnixNano'] hash['attributes'].each do |attribute_hash| attribute = OtelAttribute.from_hash(attribute_hash) span.add_attribute(attribute) end span end |
Instance Method Details
#add_attribute(attribute) ⇒ Object
15 16 17 |
# File 'lib/maze/api/model/span.rb', line 15 def add_attribute(attribute) @attributes[attribute.key] = attribute end |