Tracing class final

Records one span per request, and continues an incoming trace.

final app = Router()
  ..layer(Tracing(exporter))
  ..merge(routes);

A request arriving with a traceparent joins that trace as a child span; one arriving without starts a new trace. Either way the response carries the traceparent of the span that answered, so a client can quote it in a bug report and an operator can find the request.

The span is named GET /todos/{id} — the route, not the path — because naming it after the path makes every id its own operation and a dashboard of a million one-request operations says nothing. The route is only known after matching, so the name is corrected once the handler returns, from matchedPathOf. A request that reached the fallback keeps its path, since no route claimed it.

Implemented types

Constructors

Tracing(SpanExporter exporter, {String? serviceName})
Exports finished spans to exporter.
const

Properties

exporter → SpanExporter
Where finished spans go.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
serviceName → String?
Recorded as service.name when given.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMiddleware() → Middleware
Builds the shelf middleware this value configures.
override
toString() → String
A string representation of this object.
inherited

Operators

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