pub struct RequestMetrics { /* private fields */ }Expand description
Request metrics collector
Implementations§
Source§impl RequestMetrics
impl RequestMetrics
Sourcepub fn record_request(
&self,
route: &str,
method: &str,
status: u16,
duration: Duration,
)
pub fn record_request( &self, route: &str, method: &str, status: u16, duration: Duration, )
Record a completed request
Sourcepub fn inc_active_requests(&self)
pub fn inc_active_requests(&self)
Increment active request counter
Sourcepub fn dec_active_requests(&self)
pub fn dec_active_requests(&self)
Decrement active request counter
Sourcepub fn record_upstream_attempt(&self, upstream: &str, route: &str)
pub fn record_upstream_attempt(&self, upstream: &str, route: &str)
Record an upstream attempt
Sourcepub fn record_upstream_failure(&self, upstream: &str, route: &str, reason: &str)
pub fn record_upstream_failure(&self, upstream: &str, route: &str, reason: &str)
Record an upstream failure
Sourcepub fn set_circuit_breaker_state(
&self,
component: &str,
route: &str,
is_open: bool,
)
pub fn set_circuit_breaker_state( &self, component: &str, route: &str, is_open: bool, )
Update circuit breaker state
Sourcepub fn record_agent_latency(&self, agent: &str, event: &str, duration: Duration)
pub fn record_agent_latency(&self, agent: &str, event: &str, duration: Duration)
Record agent call latency
Sourcepub fn record_agent_timeout(&self, agent: &str, event: &str)
pub fn record_agent_timeout(&self, agent: &str, event: &str)
Record agent timeout
Sourcepub fn record_blocked_request(&self, reason: &str)
pub fn record_blocked_request(&self, reason: &str)
Record a blocked request
Sourcepub fn record_request_body_size(&self, route: &str, size_bytes: usize)
pub fn record_request_body_size(&self, route: &str, size_bytes: usize)
Record request body size
Sourcepub fn record_response_body_size(&self, route: &str, size_bytes: usize)
pub fn record_response_body_size(&self, route: &str, size_bytes: usize)
Record response body size
Sourcepub fn record_tls_handshake(&self, version: &str, duration: Duration)
pub fn record_tls_handshake(&self, version: &str, duration: Duration)
Record TLS handshake duration
Sourcepub fn update_connection_pool(&self, upstream: &str, size: i64, idle: i64)
pub fn update_connection_pool(&self, upstream: &str, size: i64, idle: i64)
Update connection pool metrics
Sourcepub fn record_connection_acquired(&self, upstream: &str)
pub fn record_connection_acquired(&self, upstream: &str)
Record connection acquisition from pool
Sourcepub fn update_system_metrics(&self)
pub fn update_system_metrics(&self)
Update system metrics
Sourcepub fn set_open_connections(&self, count: i64)
pub fn set_open_connections(&self, count: i64)
Set open connections count
Auto Trait Implementations§
impl Freeze for RequestMetrics
impl !RefUnwindSafe for RequestMetrics
impl Send for RequestMetrics
impl Sync for RequestMetrics
impl Unpin for RequestMetrics
impl !UnwindSafe for RequestMetrics
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more