Skip to content

Commit

Permalink
fix: use consistent query name in uplink metrics (#5816)
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop authored Aug 19, 2024
1 parent da61b66 commit ae522fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changesets/fix_renee_consistent_uplink_type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Fix inconsistent `type` attribute in `apollo.router.uplink.fetch.duration` metric ([PR #5816](https://github.com/apollographql/router/pull/5816))

The router now always reports a short name in the `type` attribute for the `apollo.router.fetch.duration` metric, instead of sometimes using a fully-qualified Rust path and sometimes using a short name.

By [@goto-bus-stop](https://github.com/goto-bus-stop) in https://github.com/apollographql/router/pull/5816
4 changes: 2 additions & 2 deletions apollo-router/src/uplink/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ where
tracing::info!(
histogram.apollo_router_uplink_fetch_duration_seconds =
now.elapsed().as_secs_f64(),
query = std::any::type_name::<Query>(),
query,
url = url.to_string(),
"kind" = "http_error",
error = e.to_string(),
Expand All @@ -441,7 +441,7 @@ fn query_name<Query>() -> &'static str {
let mut query = std::any::type_name::<Query>();
query = query
.strip_suffix("Query")
.expect("Uplink structs mut be named xxxQuery")
.expect("Uplink structs must be named xxxQuery")
.get(query.rfind("::").map(|index| index + 2).unwrap_or_default()..)
.expect("cannot fail");
query
Expand Down

0 comments on commit ae522fb

Please sign in to comment.