otel_http library

OpenTelemetry instrumentation for package:http.

See OTelHttpClient for usage.

Classes

OTelHttpClient
OpenTelemetry instrumentation for package:http.

Functions

httpInstrumentationSuppressed() → bool
Returns true when the current zone has opted out of HTTP OTel instrumentation.
httpRequestInstrumented() → bool
Returns true while the current zone is sending a request that OTelHttpClient instruments.
runAsInstrumentedHttp<T>(Future<T> body()) → Future<T>
Runs body marked as instrumented: see httpRequestInstrumented. OTelHttpClient sends every request this way; a hand-written instrumented client can do the same.
runWithoutHttpInstrumentation<T>(T body()) → T
Runs body in a zone where OTelHttpClient.send will skip span creation and header injection.
runWithoutHttpInstrumentationAsync<T>(Future<T> body()) → Future<T>
Async variant of runWithoutHttpInstrumentation. Both forms are safe to nest; they no-op once already inside a suppressed zone.