otel_http 0.1.0-beta.1
otel_http: ^0.1.0-beta.1 copied to clipboard
OpenTelemetry instrumentation for `package:http`. Wraps any `http.Client` to emit a CLIENT-kind span per request with the HTTP semantic-convention attributes, injects W3C trace-context headers, and re [...]
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.1.0-beta.1 - 2026-05-14 #
Added #
OTelHttpClient— ahttp.BaseClientthat wraps anotherhttp.Clientand emits aCLIENT-kind span per request with the HTTP semantic-convention attributes set (http.request.method,url.full,url.scheme,url.path,url.query,server.address,server.port,http.request.body.size,user_agent.original,http.response.status_code,http.response.body.size).- W3C
traceparent/tracestate/baggageheaders injected into outbound requests so downstream services join the same trace. - 4xx / 5xx responses flip span status to
Error. Thrown exceptions triggerrecordException(with stack trace) andsetStatus(Error), in OTel-spec order, witherror.typeset to the exception's runtime class. - URL
userInfo(https://alice:secret@host/...) is redacted inurl.fullper the OTel HTTP semconv guidance. spanNameBuilderconstructor option for callers that know a URL template (recommended span name is{METHOD} {url-template}).runWithoutHttpInstrumentation/runWithoutHttpInstrumentationAsync— zone-scoped suppression helpers.OTelHttpClient.sendchecks a zone flag at the top of every call and skips span creation AND header injection when set. Backs the self-recursion guarantee: the SDK's OTLP/HTTP exporter usespackage:httpitself, so wrapping an exporter call in this helper prevents the export-creates-span-creates- export loop. Matches the pattern used bydartastic_grpc_otel.- 10 unit tests covering happy path, header injection, 4xx, 5xx, transport exception, userinfo redaction, body size, custom span name, parent-span inheritance, and the suppression scope. 1 LGTM integration test polling Tempo round-trip.
- Targets
http: ^1.0.0.