Class: Riffer::Tracing::Otel::Span
- Inherits:
-
Object
- Object
- Riffer::Tracing::Otel::Span
- Defined in:
- lib/riffer/tracing/otel.rb
Overview
Wraps a live OTEL span behind the port’s span surface, so callers never touch ::OpenTelemetry constants (status objects in particular).
Instance Method Summary collapse
-
#add_event(name, attributes: nil) ⇒ Object
– : (String, ?attributes: Hash[String, untyped]?) -> void.
-
#error!(description = "") ⇒ Object
Marks the span status as error.
-
#initialize(otel_span) ⇒ Span
constructor
– : (untyped) -> void.
-
#record_exception(exception) ⇒ Object
– : (Exception) -> void.
-
#recording? ⇒ Boolean
– : () -> bool.
-
#set_attribute(key, value) ⇒ Object
– : (String, untyped) -> void.
Constructor Details
#initialize(otel_span) ⇒ Span
– : (untyped) -> void
17 18 19 |
# File 'lib/riffer/tracing/otel.rb', line 17 def initialize(otel_span) @otel_span = otel_span end |
Instance Method Details
#add_event(name, attributes: nil) ⇒ Object
– : (String, ?attributes: Hash[String, untyped]?) -> void
29 30 31 |
# File 'lib/riffer/tracing/otel.rb', line 29 def add_event(name, attributes: nil) @otel_span.add_event(name, attributes: attributes) end |
#error!(description = "") ⇒ Object
Marks the span status as error. – : (?String) -> void
42 43 44 |
# File 'lib/riffer/tracing/otel.rb', line 42 def error!(description = "") @otel_span.status = ::OpenTelemetry::Trace::Status.error(description) end |
#record_exception(exception) ⇒ Object
– : (Exception) -> void
35 36 37 |
# File 'lib/riffer/tracing/otel.rb', line 35 def record_exception(exception) @otel_span.record_exception(exception) end |
#recording? ⇒ Boolean
– : () -> bool
48 49 50 |
# File 'lib/riffer/tracing/otel.rb', line 48 def recording? @otel_span.recording? end |
#set_attribute(key, value) ⇒ Object
– : (String, untyped) -> void
23 24 25 |
# File 'lib/riffer/tracing/otel.rb', line 23 def set_attribute(key, value) @otel_span.set_attribute(key, value) end |