Skip to content

Commit

Permalink
Report a metric to Apollo if fragment reuse is enabled (#6267)
Browse files Browse the repository at this point in the history
Co-authored-by: Bryn Cooke <[email protected]>
  • Loading branch information
goto-bus-stop and BrynCooke authored Nov 18, 2024
1 parent 0bdea7e commit c3b8637
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apollo-router/src/configuration/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ impl Metrics {
data.populate_user_plugins_instrument(configuration);
data.populate_query_planner_experimental_parallelism(configuration);
data.populate_deno_or_rust_mode_instruments(configuration);
data.populate_legacy_fragment_usage(configuration);

data.into()
}
}
Expand Down Expand Up @@ -494,6 +496,18 @@ impl InstrumentData {
);
}

pub(crate) fn populate_legacy_fragment_usage(&mut self, configuration: &Configuration) {
// Fragment generation takes precedence over fragment reuse. Only report when fragment reuse is *actually active*.
if configuration.supergraph.reuse_query_fragments == Some(true)
&& !configuration.supergraph.generate_query_fragments
{
self.data.insert(
"apollo.router.config.reuse_query_fragments".to_string(),
(1, HashMap::new()),
);
}
}

pub(crate) fn populate_query_planner_experimental_parallelism(
&mut self,
configuration: &Configuration,
Expand Down

0 comments on commit c3b8637

Please sign in to comment.