Span class final

One timed operation inside a trace.

Mutable on purpose. A handler adds attributes to the span it is already inside while the work happens, and forcing a rebuild for each one would put plumbing in every handler that wants to record a customer id.

Constructors

Span({required String name, required TraceContext context, String? parentSpanId, DateTime? startedAt, Map<String, Object?>? attributes})
Starts a span named name in context.

Properties

attributes → Map<String, Object?>
What was recorded about it.
final
context → TraceContext
The trace and span ids.
final
duration → Duration?
How long it ran, or null while it is running.
no setter
endedAt ↔ DateTime?
When it finished, or null while it is running.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
isFinished → bool
Whether it has finished.
no setter
name ↔ String
What this span measures: GET /todos/{id}, db.query.
getter/setter pair
parentSpanId → String?
The span this one is inside, or null at the root of a trace.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
startedAt → DateTime
When it started, in UTC.
final
status ↔ SpanStatus
How it finished.
getter/setter pair

Methods

child(String name) → Span
Starts a child span of this one, in the same trace.
end({DateTime? at, SpanStatus? status}) → void
Marks this span finished.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setAttribute(String key, Object? value) → void
Records one attribute.
setAttributes(Map<String, Object?> values) → void
Records several attributes at once.
toString() → String
A string representation of this object.
override

Operators

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