pub struct TimingMetricsConfig {
pub add_server_timing_header: bool,
pub add_response_time_header: bool,
pub response_time_header_name: String,
pub include_custom_metrics: bool,
pub include_ttfb: bool,
}Expand description
Configuration for the timing metrics middleware.
Fields§
§add_server_timing_header: boolWhether to add the Server-Timing header.
add_response_time_header: boolWhether to add the X-Response-Time header.
response_time_header_name: StringCustom header name for response time (default: “X-Response-Time”).
include_custom_metrics: boolWhether to include custom metrics from handlers.
include_ttfb: boolWhether to include TTFB in the Server-Timing header.
Implementations§
Source§impl TimingMetricsConfig
impl TimingMetricsConfig
Sourcepub fn server_timing(self, enabled: bool) -> Self
pub fn server_timing(self, enabled: bool) -> Self
Enable or disable Server-Timing header.
Sourcepub fn response_time(self, enabled: bool) -> Self
pub fn response_time(self, enabled: bool) -> Self
Enable or disable X-Response-Time header.
Sourcepub fn response_time_header(self, name: impl Into<String>) -> Self
pub fn response_time_header(self, name: impl Into<String>) -> Self
Set a custom response time header name.
Sourcepub fn custom_metrics(self, enabled: bool) -> Self
pub fn custom_metrics(self, enabled: bool) -> Self
Enable or disable custom metrics.
Sourcepub fn production() -> Self
pub fn production() -> Self
Create a production-safe config (minimal headers).
Sourcepub fn development() -> Self
pub fn development() -> Self
Create a development config (all timing info exposed).
Trait Implementations§
Source§impl Clone for TimingMetricsConfig
impl Clone for TimingMetricsConfig
Source§fn clone(&self) -> TimingMetricsConfig
fn clone(&self) -> TimingMetricsConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TimingMetricsConfig
impl Debug for TimingMetricsConfig
Auto Trait Implementations§
impl Freeze for TimingMetricsConfig
impl RefUnwindSafe for TimingMetricsConfig
impl Send for TimingMetricsConfig
impl Sync for TimingMetricsConfig
impl Unpin for TimingMetricsConfig
impl UnwindSafe for TimingMetricsConfig
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).