Skip to main content

Module legacy_client

Module legacy_client 

Source
Expand description

Async instrumentation helpers for hyper_util::client::legacy::Client. Async hyper-util legacy client instrumentation helpers.

This module instruments hyper_util::client::legacy::Client requests with OpenTelemetry client spans and trace-context propagation.

§Example

use bytes::Bytes;
use http_body_util::Empty;
use hyper::{Request, header::USER_AGENT};
use hyper_util::rt::TokioExecutor;
use telemetry_rust::instrumentations::http::hyper::HyperLegacyClientInstrument;

let client = hyper_util::client::legacy::Client::builder(TokioExecutor::new())
    .build_http::<Empty<Bytes>>()
    .instrument();

let response = client
    .request(
        Request::builder()
            .uri("http://127.0.0.1:3000/health")
            .header(USER_AGENT, "telemetry-rust")
            .body(Empty::<Bytes>::new())?,
    )
    .await?;

Structs§

InstrumentedLegacyClient
A reusable wrapper around hyper_util::client::legacy::Client that records client spans for each request sent through the client.

Traits§

HyperLegacyClientInstrument
A trait for creating instrumented hyper-util legacy clients with OpenTelemetry tracing.