HttpSpanRecorder class

Shared recorder that emits incubating <HTTP method> catalog attributes and phase events for all Flutter HTTP clients.

Constructors

HttpSpanRecorder.start({required String tracerName, required String method, required Uri url, required Set<HttpTimingPhase> supportedPhases, Context? context})
Starts a client span named after the (normalized) HTTP method.
factory

Properties

elapsedTotalMs double
Elapsed time since the recorder started, for orphan-span snapshots.
no setter
hashCode int
The hash code for this object.
no setterinherited
originalMethod String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
span Span
final
supportedPhases Set<HttpTimingPhase>
final
url Uri
final

Methods

applyConnectTiming(HttpClientConnectTiming? timing) → void
Applies connect/DNS timings captured by createInstrumentedHttpClient.
applyPeer({String? address, int? port}) → void
applyRequestHeaders(Map<String, String> headers) → void
Captures allowlisted request headers as http.request.header.<name>.
applyRequestHttpHeaders(HttpHeaders headers) → void
Captures allowlisted request headers from dart:io HttpHeaders.
applyResponse({required int statusCode, String? reasonPhrase, String? protocolVersion}) → void
applyResponseHeaders(Map<String, String> headers) → void
Captures allowlisted response headers as http.response.header.<name>.
applyResponseHttpHeaders(HttpHeaders headers) → void
Captures allowlisted response headers from dart:io HttpHeaders.
end({double? totalMs}) → void
Ends the client span.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onError(Object error, [StackTrace? stackTrace, String? errorCategory]) → void
recordPhase(HttpTimingPhase phase, double? durationMs) → void
Records a measured phase duration in milliseconds.
resolvePeerWithDns() Future<String>
Resolves url.host (timed) and records dns phase + peer address.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

capturesRequestHeaders bool
Whether any request header is allowlisted for capture.
no setter
capturesResponseHeaders bool
Whether any response header is allowlisted for capture. See capturesRequestHeaders.
no setter

Static Methods

classifyError(Object error) String
Classifies a transport/HTTP failure into a catalog http.error.category.