Class: Arcp::Job::EventBody::TraceSpan
- Inherits:
-
Data
- Object
- Data
- Arcp::Job::EventBody::TraceSpan
- Defined in:
- lib/arcp/job/event_body/trace_span.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#end_at ⇒ Object
readonly
Returns the value of attribute end_at.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent_span_id ⇒ Object
readonly
Returns the value of attribute parent_span_id.
-
#span_id ⇒ Object
readonly
Returns the value of attribute span_id.
-
#start_at ⇒ Object
readonly
Returns the value of attribute start_at.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes
6 7 8 |
# File 'lib/arcp/job/event_body/trace_span.rb', line 6 def attributes @attributes end |
#end_at ⇒ Object (readonly)
Returns the value of attribute end_at
6 7 8 |
# File 'lib/arcp/job/event_body/trace_span.rb', line 6 def end_at @end_at end |
#name ⇒ Object (readonly)
Returns the value of attribute name
6 7 8 |
# File 'lib/arcp/job/event_body/trace_span.rb', line 6 def name @name end |
#parent_span_id ⇒ Object (readonly)
Returns the value of attribute parent_span_id
6 7 8 |
# File 'lib/arcp/job/event_body/trace_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/arcp/job/event_body/trace_span.rb', line 6 def span_id @span_id end |
#start_at ⇒ Object (readonly)
Returns the value of attribute start_at
6 7 8 |
# File 'lib/arcp/job/event_body/trace_span.rb', line 6 def start_at @start_at end |
Class Method Details
.from_h(h) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/arcp/job/event_body/trace_span.rb', line 7 def self.from_h(h) h = h.transform_keys(&:to_s) new( span_id: h.fetch('span_id'), parent_span_id: h['parent_span_id'], name: h.fetch('name'), start_at: h['start_at'], end_at: h['end_at'], attributes: h['attributes'] || {} ) end |
Instance Method Details
#to_h ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/arcp/job/event_body/trace_span.rb', line 19 def to_h out = { 'span_id' => span_id, 'name' => name } out['parent_span_id'] = parent_span_id if parent_span_id out['start_at'] = start_at if start_at out['end_at'] = end_at if end_at out['attributes'] = attributes unless attributes.empty? out end |