logo
pub struct OpenTelemetryTracingMiddleware { /* private fields */ }
Expand description

The middleware struct to be used in surf

Implementations

Instantiate the middleware

Examples
let _tracer = opentelemetry_jaeger::new_pipeline().install_batch(opentelemetry::runtime::AsyncStd)?;
let tracer = global::tracer("my-client");
let otel_mw = opentelemetry_surf::OpenTelemetryTracingMiddleware::new(tracer);
let client = surf::client().with(otel_mw);
let res = client.get("https://httpbin.org/get").await?;
dbg!(res);
Ok(())

Instantiate the middleware with the global tracer

Examples
let _tracer = opentelemetry_jaeger::new_pipeline().install_batch(opentelemetry::runtime::AsyncStd)?;
let otel_mw = opentelemetry_surf::OpenTelemetryTracingMiddleware::new_from_global();
let client = surf::client().with(otel_mw);
let res = client.get("https://httpbin.org/get").await?;
dbg!(res);
Ok(())

Trait Implementations

Formats the value using the given formatter. Read more

Instantiate the middleware with the global tracer as default; see OpenTelemetryTracingMiddleware::new_from_global for details/example.

Asynchronously handle the request, and return a response.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Attaches the provided Context to this type, returning a WithContext wrapper. Read more

Attaches the current Context to this type, returning a WithContext wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more