SpanData class final

An immutable snapshot of a finished span.

Span is mutable while it is open — that is unavoidable, since attributes are discovered as the work proceeds. Exporters receive this frozen snapshot instead, so a slow exporter can never observe a torn or later-mutated span.

Annotations
  • @immutable

Constructors

SpanData({required String name, required TraceContext context, required SpanKind kind, required DateTime startTime, required DateTime endTime, required SpanStatus status, String? statusMessage, Map<String, Object?> attributes = const <String, Object?>{}, List<SpanEvent> events = const <SpanEvent>[]})
Creates a finished-span snapshot.

Properties

attributes → JsonMap
Structured attributes describing the operation.
final
context → TraceContext
Identity of this span within its trace.
final
duration → Duration
How long the operation took.
no setter
endTime → DateTime
When the span ended, in UTC.
final
events → List<SpanEvent>
Points of interest recorded during the span.
final
hashCode → int
The hash code for this object.
no setterinherited
kind → SpanKind
What kind of work this span represents.
final
name → String
Operation name, such as llm.generate or tool.web_search.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
startTime → DateTime
When the span started, in UTC.
final
status → SpanStatus
Recorded outcome.
final
statusMessage → String?
Human-readable detail about a non-ok status.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → JsonMap
Serialises the span.
toString() → String
A string representation of this object.
override

Operators

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