Skip to main content

otel_http 0.1.0-beta.1 copy "otel_http: ^0.1.0-beta.1" to clipboard
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 — a http.BaseClient that wraps another http.Client and emits a CLIENT-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 / baggage headers injected into outbound requests so downstream services join the same trace.
  • 4xx / 5xx responses flip span status to Error. Thrown exceptions trigger recordException (with stack trace) and setStatus(Error), in OTel-spec order, with error.type set to the exception's runtime class.
  • URL userInfo (https://alice:secret@host/...) is redacted in url.full per the OTel HTTP semconv guidance.
  • spanNameBuilder constructor option for callers that know a URL template (recommended span name is {METHOD} {url-template}).
  • runWithoutHttpInstrumentation / runWithoutHttpInstrumentationAsync — zone-scoped suppression helpers. OTelHttpClient.send checks 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 uses package:http itself, so wrapping an exporter call in this helper prevents the export-creates-span-creates- export loop. Matches the pattern used by dartastic_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.
0
likes
0
points
861
downloads

Publisher

verified publisherdartastic.io

Weekly Downloads

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 records exceptions / 4xx-5xx as Error status.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dartastic_opentelemetry, dartastic_opentelemetry_api, http

More

Packages that depend on otel_http