diff --git a/parity/metrics.rs b/parity/metrics.rs index 6baf22795f6..90b2da96138 100644 --- a/parity/metrics.rs +++ b/parity/metrics.rs @@ -58,8 +58,7 @@ async fn handle_request(req: Request, state: Arc>) -> Respons state.rpc_apis.client.prometheus_metrics(&mut reg); state.rpc_apis.sync.prometheus_metrics(&mut reg); let elapsed = start.elapsed(); - let ms = (elapsed.as_secs() as i64)*1000 + (elapsed.subsec_millis() as i64); - prometheus_gauge(&mut reg, "metrics_time", "Time to perform rpc metrics", ms); + prometheus_gauge(&mut reg, "metrics_time", "Time to perform rpc metrics", elapsed.as_millis() as i64); let mut buffer = vec![]; let encoder = prometheus::TextEncoder::new(); diff --git a/util/stats/src/lib.rs b/util/stats/src/lib.rs index 2523f160de0..b8cca58d483 100644 --- a/util/stats/src/lib.rs +++ b/util/stats/src/lib.rs @@ -48,8 +48,7 @@ pub fn prometheus_optime T, T>(r: &mut prometheus::Registry, name: &s let start = Instant::now(); let t = f(); let elapsed = start.elapsed(); - let ms = (elapsed.as_secs() as i64)*1000 + (elapsed.subsec_millis() as i64); - prometheus_gauge(r, &format!("optime_{}",name), &format!("Time to perform {}",name), ms); + prometheus_gauge(r, &format!("optime_{}",name), &format!("Time to perform {}",name), elapsed.as_millis() as i64); t }