LocalSpan class
A span created in this process.
Spans are usually created by Tracer.trace (or Telemetry.trace), which
ends them when the traced code returns. Spans created by
Tracer.startSpan have to be ended by calling end.
A span is handed to the exporter when it starts, so it is visible even if it never ends (e.g. when the service crashes), and again when it ends if it was exported while running. Changes after end are ignored.
Constructors
Properties
-
attributes
→ UnmodifiableMapView<
String, Object?> -
no setter
- endTimestamp → DateTime?
-
no setter
- errorDescription → String?
-
Describes why the operation failed, if hasError.
no setter
-
events
→ UnmodifiableListView<
Event> -
no setter
- hasError → bool
-
Whether the operation of this span failed, see setError.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEnded → bool
-
no setter
- isRemote → bool
-
Whether this span was created in another process.
finalinherited
- isSampled → bool
-
no setterinherited
- name → String
-
no setter
- parent → Span?
-
final
- parentSpanId → SpanId?
-
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- spanId → SpanId
-
finalinherited
- startTimestamp → DateTime?
-
no setter
- traceFlags → int
-
W3C trace flags, see flagSampled.
finalinherited
- traceId → TraceId
-
finalinherited
- tracer → Tracer
-
final
- type → SpanType?
-
final
Methods
-
addEvent(
String name, {Map< String, Object?> ? attributes}) → void -
end(
[DateTime? timestamp]) → void -
Ends the span at
timestamp, which defaults to now. Calling end again has no effect. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
recordException(
Object error, {StackTrace? stack, bool setError = true}) → void -
Records
erroras anexceptionevent and marks the span as failed, unlesssetErroris false (e.g. for errors caused by the caller). -
setAttribute(
String name, Object value) → void -
Sets the attribute
name, replacing an existing value. -
setError(
[String? description]) → void - Marks the operation of this span as failed.
-
start(
[DateTime? timestamp]) → void -
Starts the span at
timestamp, which defaults to now. Calling start again has no effect. -
toString(
) → String -
A string representation of this object.
inherited
-
updateName(
String name) → void - Replaces the name, e.g. once the route of a request is known.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited