Class: Traces::Backend::Capture::Span
- Inherits:
-
Object
- Object
- Traces::Backend::Capture::Span
- Defined in:
- lib/traces/backend/capture.rb
Overview
A span which validates tag assignment.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
-
#[]=(key, value) ⇒ Object
Assign some metadata to the span.
- #as_json ⇒ Object
-
#initialize(context, name, resource, attributes) ⇒ Span
constructor
A new instance of Span.
- #to_json ⇒ Object
Constructor Details
#initialize(context, name, resource, attributes) ⇒ Span
Returns a new instance of Span.
20 21 22 23 24 25 |
# File 'lib/traces/backend/capture.rb', line 20 def initialize(context, name, resource, attributes) @context = context @name = name @resource = resource @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
30 31 32 |
# File 'lib/traces/backend/capture.rb', line 30 def attributes @attributes end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
27 28 29 |
# File 'lib/traces/backend/capture.rb', line 27 def context @context end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
28 29 30 |
# File 'lib/traces/backend/capture.rb', line 28 def name @name end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
29 30 31 |
# File 'lib/traces/backend/capture.rb', line 29 def resource @resource end |
Instance Method Details
#[]=(key, value) ⇒ Object
Assign some metadata to the span.
35 36 37 |
# File 'lib/traces/backend/capture.rb', line 35 def []= key, value @attributes[key] = value end |
#as_json ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/traces/backend/capture.rb', line 39 def as_json { name: @name, resource: @resource, attributes: @attributes, context: @context.as_json } end |
#to_json ⇒ Object
48 49 50 |
# File 'lib/traces/backend/capture.rb', line 48 def to_json(...) as_json.to_json(...) end |