Skip to content

Commit

Permalink
Experimental operation error metrics: rename source -> service (#6709)
Browse files Browse the repository at this point in the history
  • Loading branch information
timbotnik authored Jan 31, 2025
2 parents 2c9e9b8 + 3c44835 commit b09c871
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
17 changes: 9 additions & 8 deletions .changesets/exp_njm_operation_error_metrics.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
### Experimental per-operation error metrics ([PR #6443](https://github.com/apollographql/router/pull/6443), [PR #6666](https://github.com/apollographql/router/pull/6666))

Adds a new experimental OpenTelemetry metric that includes error counts at a per-operation and per-client level. These metrics contain the following attributes:
* Operation name
* Operation type (query/mutation/subscription)
* Apollo operation ID
* Client name
* Client version
* Error code
* Path
* Source (subgraph name)

- Operation name
- Operation type (query/mutation/subscription)
- Apollo operation ID
- Client name
- Client version
- Error code
- Path
- Service (subgraph name)

This metric is currently only sent to GraphOS and is not available in 3rd-party OTel destinations. The metric can be enabled using the configuration `telemetry.apollo.errors.experimental_otlp_error_metrics: enabled`.

Expand Down
2 changes: 1 addition & 1 deletion apollo-router/src/services/router/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ impl RouterService {
"apollo.client.version" = client_version.clone(),
"graphql.error.extensions.code" = code_str,
"graphql.error.path" = path,
"apollo.router.error.source" = service
"apollo.router.error.service" = service
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions apollo-router/src/services/router/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ async fn it_stores_operation_error_when_config_is_enabled() {
KeyValue::new("apollo.client.version", client_version),
KeyValue::new("graphql.error.extensions.code", "SOME_ERROR_CODE"),
KeyValue::new("graphql.error.path", "/obj/field"),
KeyValue::new("apollo.router.error.source", "mySubgraph"),
KeyValue::new("apollo.router.error.service", "mySubgraph"),
]
);
assert_counter!(
Expand All @@ -711,7 +711,7 @@ async fn it_stores_operation_error_when_config_is_enabled() {
KeyValue::new("apollo.client.version", client_version),
KeyValue::new("graphql.error.extensions.code", "SOME_OTHER_ERROR_CODE"),
KeyValue::new("graphql.error.path", "/obj/arr/@/firstElementField"),
KeyValue::new("apollo.router.error.source", "myOtherSubgraph"),
KeyValue::new("apollo.router.error.service", "myOtherSubgraph"),
]
);
}
Expand Down

0 comments on commit b09c871

Please sign in to comment.