Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Use Duration::as_millis()
Browse files Browse the repository at this point in the history
  • Loading branch information
adria0 committed Jul 18, 2020
1 parent 0a4bd5c commit 16d89fc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions parity/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ async fn handle_request(req: Request<Body>, state: Arc<Mutex<State>>) -> 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();
Expand Down
3 changes: 1 addition & 2 deletions util/stats/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ pub fn prometheus_optime<F: Fn() -> 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
}

Expand Down

0 comments on commit 16d89fc

Please sign in to comment.