From 6c3691afdee003eac3e5e0bba144dd327978945f Mon Sep 17 00:00:00 2001 From: JP <36560907+0xfourzerofour@users.noreply.github.com> Date: Fri, 4 Oct 2024 17:21:17 -0400 Subject: [PATCH] feat(funder): change latency metrics to millis (#829) --- crates/rpc/src/metrics.rs | 3 ++- crates/task/src/grpc/metrics.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/rpc/src/metrics.rs b/crates/rpc/src/metrics.rs index 0214daa78..f609d10ad 100644 --- a/crates/rpc/src/metrics.rs +++ b/crates/rpc/src/metrics.rs @@ -98,6 +98,7 @@ impl RpcMetrics { } fn record_request_latency(method_name: String, latency: Duration) { - metrics::histogram!("rpc_request_latency", "method_name" => method_name).record(latency); + metrics::histogram!("rpc_request_latency", "method_name" => method_name) + .record(latency.as_millis() as f64); } } diff --git a/crates/task/src/grpc/metrics.rs b/crates/task/src/grpc/metrics.rs index 75b05fd69..9b72d6642 100644 --- a/crates/task/src/grpc/metrics.rs +++ b/crates/task/src/grpc/metrics.rs @@ -152,6 +152,6 @@ impl GrpcMetricsRecorder { // Record the latency of a request for a given method and service. fn record_request_latency(method_name: &str, scope: &str, latency: Duration) { - metrics::histogram!("grpc_request_latency", "method_name" => method_name.to_string(), "service" => scope.to_string()).record(latency) + metrics::histogram!("grpc_request_latency", "method_name" => method_name.to_string(), "service" => scope.to_string()).record(latency.as_millis() as f64) } }