Span class final

Represents a single operation within a trace.

A span from LDObserve.startSpan is the current span, and the parent of spans started after it, until end is called. End nested spans in reverse order of starting them. For work that spans awaits, prefer LDObserve.withSpan, which ends the span for you and keeps it current across asynchronous gaps.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addEvent(String name, {Map<String, Object?>? attributes}) → void
Add an event to the span with the given attributes.
end() → void
Ends the span, recording its end time, and stops it being the current span. Calls after the first have no effect.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
recordException(dynamic exception, {StackTrace stackTrace = StackTrace.empty, Map<String, Object?>? attributes}) → void
Record information about an exception that happened during this span.
setAttribute(String name, Object? value) → void
Set an attribute on the span.
setAttributes(Map<String, Object?> attributes) → void
Set attributes on the span. For details about attributes refer to setAttribute.
setStatus(SpanStatusCode status) → void
Sets the span's status. Spans default to SpanStatusCode.unset; set SpanStatusCode.error when the operation failed.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited