From 6294baceba74cabed3236f98a48ca552b73427cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 28 Nov 2024 12:59:55 +0100 Subject: [PATCH] Use new histogram macro to report QP warmup time Notes: - The name of the metric used a `.` instead of `_` in `query_planning`. Is it breaking to change that? I'm not sure I understand the difference --- apollo-router/src/plugins/telemetry/utils.rs | 6 +++++- apollo-router/src/query_planner/caching_query_planner.rs | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apollo-router/src/plugins/telemetry/utils.rs b/apollo-router/src/plugins/telemetry/utils.rs index 42b57f122ce..c06c9b128b4 100644 --- a/apollo-router/src/plugins/telemetry/utils.rs +++ b/apollo-router/src/plugins/telemetry/utils.rs @@ -20,7 +20,11 @@ impl TracingUtils for bool { /// Timer implementing Drop to automatically compute the duration between the moment it has been created until it's dropped ///```ignore /// Timer::new(|duration| { -/// tracing::info!(histogram.apollo_router_test = duration.as_secs_f64()); +/// f64_histogram!( +/// "apollo_router_test", +/// "Time spent testing the timer", +/// duration.as_secs_f64() +/// ); /// }) /// ``` pub(crate) struct Timer diff --git a/apollo-router/src/query_planner/caching_query_planner.rs b/apollo-router/src/query_planner/caching_query_planner.rs index 209adcc856c..2bf905adbe8 100644 --- a/apollo-router/src/query_planner/caching_query_planner.rs +++ b/apollo-router/src/query_planner/caching_query_planner.rs @@ -173,8 +173,10 @@ where experimental_pql_prewarm: &PersistedQueriesPrewarmQueryPlanCache, ) { let _timer = Timer::new(|duration| { - ::tracing::info!( - histogram.apollo.router.query.planning.warmup.duration = duration.as_secs_f64() + f64_histogram!( + "apollo.router.query_planning.warmup.duration", + "Time spent warming up the query planner queries in seconds", + duration.as_secs_f64() ); });