pub struct LatencyRecorder { /* private fields */ }Expand description
Latency recorder
Records latency samples and maintains statistics.
Implementations§
Source§impl LatencyRecorder
impl LatencyRecorder
Sourcepub async fn record(
&self,
latency_ms: u64,
endpoint: Option<String>,
method: Option<String>,
status_code: Option<u16>,
error: Option<String>,
)
pub async fn record( &self, latency_ms: u64, endpoint: Option<String>, method: Option<String>, status_code: Option<u16>, error: Option<String>, )
Record a latency sample
Sourcepub async fn get_samples(&self) -> Vec<LatencySample>
pub async fn get_samples(&self) -> Vec<LatencySample>
Get all samples
Sourcepub async fn get_samples_for_endpoint(
&self,
endpoint: &str,
) -> Vec<LatencySample>
pub async fn get_samples_for_endpoint( &self, endpoint: &str, ) -> Vec<LatencySample>
Get samples for a specific endpoint
Sourcepub async fn get_samples_in_range(
&self,
start: DateTime<Utc>,
end: DateTime<Utc>,
) -> Vec<LatencySample>
pub async fn get_samples_in_range( &self, start: DateTime<Utc>, end: DateTime<Utc>, ) -> Vec<LatencySample>
Get samples within a time range
Sourcepub async fn sample_count(&self) -> usize
pub async fn sample_count(&self) -> usize
Get sample count
Trait Implementations§
Source§impl Clone for LatencyRecorder
impl Clone for LatencyRecorder
Source§fn clone(&self) -> LatencyRecorder
fn clone(&self) -> LatencyRecorder
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 moreAuto Trait Implementations§
impl Freeze for LatencyRecorder
impl !RefUnwindSafe for LatencyRecorder
impl Send for LatencyRecorder
impl Sync for LatencyRecorder
impl Unpin for LatencyRecorder
impl !UnwindSafe for LatencyRecorder
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