abstract class
OpenTelemetry::Trace::Span
- OpenTelemetry::Trace::Span
- Reference
- Object
Overview
A write-only span API. Implementations control the span lifetime and its recorded data. Concurrency: safe for concurrent use. Implementers must preserve this guarantee.
Direct Known Subclasses
Defined in:
api/trace/span.crInstance Method Summary
- #[]=(key : String, value) : Nil
- #add_event(name : String, attributes = nil, *, timestamp : Time | Nil = nil) : self
-
#add_event(name : String, *, timestamp : Time | Nil = nil, & : Attributes::Builder -> ) : self
Runs the attribute builder block while the span is recording.
-
#add_link(span_context : SpanContext, attributes = nil) : self
Adds a link.
-
#do_add_event(name : String, attributes : Attributes, timestamp : Time | Nil) : Nil
SPI: implementers override.
-
#do_add_link(link : Link) : Nil
SPI: implementers override.
-
#do_end(end_time : Time | Nil) : Nil
SPI: implementers override.
-
#do_set_attribute(key : String, value : AnyValue) : Nil
SPI: implementers override.
-
#do_set_status(status : Status) : Nil
SPI: implementers override.
-
#do_update_name(name : String) : Nil
SPI: implementers override.
-
#end(end_time : Time | Nil = nil) : Nil
Ends the span once without changing any active context.
- #error!(description : String | Nil = nil) : self
- #name=(name : String) : String
- #ok! : self
-
#record_exception(exception : Exception, attributes = nil, *, timestamp : Time | Nil = nil) : self
Records an exception event.
- #recording? : Bool
-
#set_attribute(key : String, value) : self
Sets one attribute.
-
#set_attributes(attributes) : self
Sets multiple attributes.
- #set_status(code : Status::Code, description : String | Nil = nil) : self
-
#span_context : SpanContext
Returns the span's immutable propagation identity.
- #status=(status : Status) : Status
- #update_name(name : String) : self
Instance Method Detail
Runs the attribute builder block while the span is recording. Block failures are reported through the error handler and the event is skipped.
Adds a link. Head samplers only see links passed at creation as links:.
A link with an invalid span context is retained if it has attributes or tracestate.
SPI: implementers override. Applications call #add_event.
SPI: implementers override. Applications call #add_link.
SPI: implementers override. Applications call #end. Ignore repeated calls.
SPI: implementers override. Applications call #set_attribute or #set_attributes.
SPI: implementers override. Applications call #set_status. Ignore changes after OK.
SPI: implementers override. Applications call #update_name.
Ends the span once without changing any active context.
Records an exception event. Supplied attributes take precedence over the generated fields.
Empty messages and missing backtraces are omitted. A stacktrace starts with
ClassName: message and continues with one backtrace frame per line.
Sets one attribute. See Tracer#start_span for passing known attributes to samplers.
Sets multiple attributes. See Tracer#start_span for passing known attributes to samplers.