Class: Traces::Backend::Test::Span
- Inherits:
-
Object
- Object
- Traces::Backend::Test::Span
- Defined in:
- lib/traces/backend/test.rb
Overview
A span which validates tag assignment.
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
-
#[]=(key, value) ⇒ Object
Assign some metadata to the span.
-
#initialize(context) ⇒ Span
constructor
Initialize a new span.
- #The context in which the span is recorded.=(context) ⇒ Object
Constructor Details
#initialize(context) ⇒ Span
Initialize a new span.
20 21 22 |
# File 'lib/traces/backend/test.rb', line 20 def initialize(context) @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
25 26 27 |
# File 'lib/traces/backend/test.rb', line 25 def context @context end |
Instance Method Details
#[]=(key, value) ⇒ Object
Assign some metadata to the span.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/traces/backend/test.rb', line 30 def []= key, value unless key.is_a?(String) || key.is_a?(Symbol) raise ArgumentError, "Invalid attribute key (must be String or Symbol): #{key.inspect}!" end begin String(value) rescue raise ArgumentError, "Invalid attribute value (must be convertible to String): #{value.inspect}!" end end |
#The context in which the span is recorded.=(context) ⇒ Object
25 |
# File 'lib/traces/backend/test.rb', line 25 attr :context |