diff --git a/riven/src/metrics.rs b/riven/src/metrics.rs index 5cdd097..64bff93 100644 --- a/riven/src/metrics.rs +++ b/riven/src/metrics.rs @@ -3,19 +3,13 @@ use std::future::Future; use crate::time::Instant; /// Returns a wrapped future that records the time it takes to complete the future as a histogram metric. -pub fn timed( - future: Fut, - operation: &'static str, - route: &'static str, -) -> impl Future +pub async fn timed(future: Fut, operation: &'static str, route: &'static str) -> Fut::Output where Fut: Future, { - async move { - let start = Instant::now(); - let out = future.await; - metrics::histogram!("riot_api", "operation" => operation, "route" => route) - .record(start.elapsed()); - out - } + let start = Instant::now(); + let out = future.await; + metrics::histogram!("riot_api", "operation" => operation, "route" => route) + .record(start.elapsed()); + out }