Skip to content

Commit

Permalink
add better migration for deprecated metric apollo_router_http_request…
Browse files Browse the repository at this point in the history
…_retry_total (#6384)

Signed-off-by: Benjamin <[email protected]>
  • Loading branch information
bnjjj authored Dec 3, 2024
1 parent 89795a7 commit dcb192c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 40 deletions.
3 changes: 3 additions & 0 deletions apollo-router/src/plugins/telemetry/config_new/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ impl DefaultForLevel for SubgraphAttributes {
if self.graphql_operation_type.is_none() {
self.graphql_operation_type = Some(StandardAttribute::Bool(true));
}
if self.http_request_resend_count.is_none() {
self.http_request_resend_count = Some(StandardAttribute::Bool(true));
}
}
DefaultAttributeRequirementLevel::None => {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,43 +127,4 @@ The following metrics have been deprecated and should not be used.
- `apollo_authentication_success_count` - **Deprecated**: use the `apollo.router.operations.authentication.jwt` metric instead. If the `authentication.jwt.failed` attribute is *absent* or `false`, the authentication succeeded.
- `apollo_require_authentication_failure_count` - **Deprecated**: use the `http.server.request.duration` metric's `http.response.status_code` attribute. Requests with authentication failures have HTTP status code 401.
- `apollo_router_timeout` - **Deprecated**: this metric conflates timed-out requests from client to the router, and requests from the router to subgraphs. Timed-out requests have HTTP status code 504. Use the `http.response.status_code` attribute on the `http.server.request.duration` metric to identify timed-out router requests, and the same attribute on the `http.client.request.duration` metric to identify timed-out subgraph requests.
- `apollo_router_http_request_retry_total` **Deprecated**: this can be achieved with custom telemetry instead. See [below for an example](#migrate-from-apollo_router_http_request_retry_total).

#### Migrate from `apollo_router_http_request_retry_total`

The below configuration filters the deprecated metric, and defines a custom histogram recording the number of retried HTTP requests to subgraphs.

```yaml title="config.router.yaml"
telemetry:
exporters:
metrics:
common:
views:
- name: apollo_router_http_request_retry_total # Drop the deprecated metric
aggregation: drop
- name: http.client.request.retry # Set the right buckets for the new metric
aggregation:
histogram:
buckets:
- 1
- 10
- 100
- 1000
instrumentation:
instruments:
subgraph:
http.client.request.retry: # Create custom histogram measuring the number of retries for http request to a subgraph
type: histogram
value:
subgraph_resend_count: true
unit: hit
description: histogram of subgraph request resend count
condition:
gt:
- subgraph_resend_count: true
- 0
attributes:
subgraph.name: true
supergraph.operation.name:
supergraph_operation_name: string
```
- `apollo_router_http_request_retry_total` **Deprecated**: use the `http.client.request.duration` metric's `http.request.resend_count` attribute. Requests with retries will contains `http.request.resend_count` set with the number of retries.

0 comments on commit dcb192c

Please sign in to comment.