Skip to content

LoggingHttpClient

Category: Observability

Source: logging_http_client.dart

Classes

LoggingHttpClient

A wrapping [http.Client] that starts/ends an [ObservabilitySpan] for every outbound request, records redacted request and response details, and tees the response body so streaming consumers still see the original bytes.

The span name is http.{spanKind} (e.g. http.llm.anthropic, http.search.brave). All spans share parent inheritance via [Observability.activeSpan] so they stitch into the current agent turn.

Constructor

dart
LoggingHttpClient({
    required this._inner,
    required Observability observability,
    required this._spanKind,
    this._maxBodyBytes = 65536,
    this._staticAttributes = const {},
  })

Methods

void close()

Released under the MIT License.