pub struct HttpInstrumentation { /* private fields */ }observability only.Expand description
Configuration for HTTP instrumentation. Convert it with
into_layer, or pass it to App::middleware.
Implementations§
Source§impl HttpInstrumentation
impl HttpInstrumentation
Sourcepub fn new() -> HttpInstrumentation
pub fn new() -> HttpInstrumentation
Tracing on (when the tracing feature is enabled), metrics off until
a meter is supplied, no propagator, no exclusions.
Sourcepub fn meter(self, meter: &Meter) -> HttpInstrumentation
Available on crate feature metrics only.
pub fn meter(self, meter: &Meter) -> HttpInstrumentation
metrics only.Records HTTP metrics with instruments created on meter.
Sourcepub fn metrics(self, metrics: HttpMetrics) -> HttpInstrumentation
Available on crate feature metrics only.
pub fn metrics(self, metrics: HttpMetrics) -> HttpInstrumentation
metrics only.Records HTTP metrics with existing instruments.
Sourcepub fn tracing(self, enabled: bool) -> HttpInstrumentation
Available on crate feature tracing only.
pub fn tracing(self, enabled: bool) -> HttpInstrumentation
tracing only.Enables or disables the per-request span.
Sourcepub fn propagator<P>(self, propagator: P) -> HttpInstrumentation
Available on crate feature tracing only.
pub fn propagator<P>(self, propagator: P) -> HttpInstrumentation
tracing only.Extracts the parent context from request headers with propagator
(typically W3C TraceContext + Baggage).
Available on crate feature tracing only.
tracing only.Like propagator, from a shared instance.
Sourcepub fn exclude(self, route: impl Into<String>) -> HttpInstrumentation
pub fn exclude(self, route: impl Into<String>) -> HttpInstrumentation
Excludes a route template (/health, /users/{id}) — or, for
requests that match no route, an exact path — from metrics and
tracing.
Sourcepub fn scheme(self, scheme: &'static str) -> HttpInstrumentation
pub fn scheme(self, scheme: &'static str) -> HttpInstrumentation
The url.scheme reported when the request URI has none (HTTP/1).
Set to "https" when TLS terminates in front of the application.
Default "http".
Sourcepub fn request_id_header(self, name: &str) -> HttpInstrumentation
pub fn request_id_header(self, name: &str) -> HttpInstrumentation
The header whose value is recorded as kerniq.request_id on the
request span. Default x-request-id (set by RequestId).
§Panics
Panics if name is not a valid header name.
Sourcepub fn into_layer(self) -> HttpLayer
pub fn into_layer(self) -> HttpLayer
Converts into a Tower layer.
Trait Implementations§
Source§impl Clone for HttpInstrumentation
impl Clone for HttpInstrumentation
Source§fn clone(&self) -> HttpInstrumentation
fn clone(&self) -> HttpInstrumentation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HttpInstrumentation
impl Debug for HttpInstrumentation
Source§impl Default for HttpInstrumentation
impl Default for HttpInstrumentation
Source§fn default() -> HttpInstrumentation
fn default() -> HttpInstrumentation
Auto Trait Implementations§
impl !Freeze for HttpInstrumentation
impl !RefUnwindSafe for HttpInstrumentation
impl !UnwindSafe for HttpInstrumentation
impl Forget for HttpInstrumentation
impl Send for HttpInstrumentation
impl Sync for HttpInstrumentation
impl Unpin for HttpInstrumentation
impl UnsafeUnpin for HttpInstrumentation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
compression-br or compression-deflate or compression-gzip or compression-zstd only.Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
trace only.Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
trace only.Source§fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
request-id only.Source§fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
request-id only.x-request-id as the header name. Read moreSource§fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
request-id only.Source§fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
request-id only.x-request-id as the header name. Read more