Skip to content

Commit

Permalink
Use new histogram macro to report QP warmup time
Browse files Browse the repository at this point in the history
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
  • Loading branch information
goto-bus-stop committed Dec 3, 2024
1 parent 48c49f4 commit 8b333e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion apollo-router/src/plugins/telemetry/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<F>
Expand Down
6 changes: 4 additions & 2 deletions apollo-router/src/query_planner/caching_query_planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
});

Expand Down

0 comments on commit 8b333e5

Please sign in to comment.