From 9365603616e5bcef6655ac5f9d7e4b7a100c8796 Mon Sep 17 00:00:00 2001 From: Darksome Date: Wed, 3 Jul 2024 10:32:09 +0000 Subject: [PATCH] fix: use Duration seconds for future metrics --- crates/metrics/src/future.rs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/crates/metrics/src/future.rs b/crates/metrics/src/future.rs index 945f3f8..f9b5e71 100644 --- a/crates/metrics/src/future.rs +++ b/crates/metrics/src/future.rs @@ -194,14 +194,8 @@ impl Drop for State { } } - self.metrics - .poll_duration - .record(duration_as_millis_f64(self.poll_duration_sum)); - - self.metrics - .poll_duration_max - .set(duration_as_millis_f64(self.poll_duration_max)); - + self.metrics.poll_duration.record(self.poll_duration_sum); + self.metrics.poll_duration_max.set(self.poll_duration_max); self.metrics.polls.increment(self.polls_count as u64); } } @@ -211,8 +205,3 @@ impl FusedFuture for Metered { self.state.is_finished } } - -#[inline] -fn duration_as_millis_f64(val: Duration) -> f64 { - val.as_secs_f64() * 1000.0 -}