pub struct MethodMetrics {
pub success_count: AtomicU64,
pub error_count: AtomicU64,
pub total_duration_ms: AtomicU64,
pub in_flight: AtomicUsize,
}Expand description
Metrics for a specific service/method
Fields§
§success_count: AtomicU64Number of successful requests
error_count: AtomicU64Number of failed requests
total_duration_ms: AtomicU64Total request duration in milliseconds
in_flight: AtomicUsizeNumber of requests currently in flight
Implementations§
Source§impl MethodMetrics
impl MethodMetrics
Sourcepub fn record_success(&self, duration_ms: u64)
pub fn record_success(&self, duration_ms: u64)
Record a successful request
Sourcepub fn record_error(&self)
pub fn record_error(&self)
Record a failed request
Sourcepub fn record_to_prometheus(
&self,
method: &str,
success: bool,
duration_ms: u64,
)
pub fn record_to_prometheus( &self, method: &str, success: bool, duration_ms: u64, )
Record to Prometheus metrics
Sourcepub fn record_to_prometheus_with_pillar(
&self,
method: &str,
success: bool,
duration_ms: u64,
pillar: &str,
)
pub fn record_to_prometheus_with_pillar( &self, method: &str, success: bool, duration_ms: u64, pillar: &str, )
Record to Prometheus metrics with pillar information
Sourcepub fn increment_in_flight(&self)
pub fn increment_in_flight(&self)
Increment in-flight requests
Sourcepub fn decrement_in_flight(&self)
pub fn decrement_in_flight(&self)
Decrement in-flight requests
Sourcepub fn snapshot(&self) -> MethodMetricsSnapshot
pub fn snapshot(&self) -> MethodMetricsSnapshot
Get a snapshot of the metrics
Trait Implementations§
Source§impl Debug for MethodMetrics
impl Debug for MethodMetrics
Auto Trait Implementations§
impl !Freeze for MethodMetrics
impl RefUnwindSafe for MethodMetrics
impl Send for MethodMetrics
impl Sync for MethodMetrics
impl Unpin for MethodMetrics
impl UnwindSafe for MethodMetrics
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§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> 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>
Wrap the input message
T in a tonic::RequestSource§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>
Wrap the input message
T in a tonic::Request