Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .changesets/breaking_zach_router_1910_telemetry_defaults.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
### Enable subgraph metrics and extended error metrics by default

Router 3.0 changes the defaults for two Apollo telemetry settings to match the preferred configuration for GraphOS Studio users, and promotes one of them out of preview.

**`telemetry.apollo.subgraph_metrics` now defaults to `true`.** Subgraph metrics send additional per-subgraph operation metrics to GraphOS Studio via OTLP, powering subgraph insights. Previously this was opt-in. To restore the previous behavior, set:

```yaml
telemetry:
apollo:
subgraph_metrics: false
```

**`telemetry.apollo.errors.preview_extended_error_metrics` has been renamed to `telemetry.apollo.errors.extended_error_metrics` and now defaults to `enabled`.** Extended error metrics send OTLP error metrics with additional dimensions (`extensions.service`, `extensions.code`), giving Studio richer error attribution out of the box. The `preview_` prefix has been dropped now that the feature is stable.

Configurations using the old `preview_extended_error_metrics` field name are migrated automatically at startup (with a warning). To restore the previous behavior, set:

```yaml
telemetry:
apollo:
errors:
extended_error_metrics: disabled
```

By [@BobaFetters](https://github.com/BobaFetters) in https://github.com/apollographql/router/pull/9879
4 changes: 2 additions & 2 deletions apollo-router/src/configuration/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,8 @@ impl InstrumentData {
"$.signature_normalization_algorithm",
opt.metrics_reference_mode,
"$.metrics_reference_mode",
opt.errors.preview_extended_error_metrics,
"$.errors.preview_extended_error_metrics",
opt.errors.extended_error_metrics,
"$.errors.extended_error_metrics",
opt.field_level_instrumentation_sampler,
"$.field_level_instrumentation_sampler",
opt.tracing.batch_processor.scheduled_delay,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: preview_extended_error_metrics is now extended_error_metrics
actions:
- type: move
from: telemetry.apollo.errors.preview_extended_error_metrics
to: telemetry.apollo.errors.extended_error_metrics
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ expression: "& metrics.non_zero()"
datapoints:
- value: 1
attributes:
opt.errors.preview_extended_error_metrics: enabled
opt.errors.extended_error_metrics: enabled
opt.field_level_instrumentation_sampler: 1
opt.metrics.otlp.batch_processor.max_export_timeout: 103s
opt.metrics.otlp.batch_processor.scheduled_delay: 5s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ expression: "& metrics.non_zero()"
datapoints:
- value: 1
attributes:
opt.errors.preview_extended_error_metrics: false
opt.errors.extended_error_metrics: false
opt.field_level_instrumentation_sampler: false
opt.metrics.otlp.batch_processor.max_export_timeout: false
opt.metrics.otlp.batch_processor.scheduled_delay: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ expression: "&schema"
"description": "Set the signature normalization algorithm to use when sending Apollo usage reports."
},
"subgraph_metrics": {
"default": false,
"default": true,
"description": "Enable sending additional subgraph metrics to Apollo Studio via OTLP",
"type": "boolean"
},
Expand Down Expand Up @@ -3652,7 +3652,7 @@ expression: "&schema"
"ErrorsConfiguration": {
"additionalProperties": false,
"properties": {
"preview_extended_error_metrics": {
"extended_error_metrics": {
"allOf": [
{
"$ref": "#/definitions/ExtendedErrorMetricsMode"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
source: apollo-router/src/configuration/tests.rs
expression: new_config
---
---
telemetry:
apollo:
errors:
extended_error_metrics: enabled
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ expression: new_config
telemetry:
apollo:
errors:
preview_extended_error_metrics: enabled
extended_error_metrics: enabled
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ supergraph:
telemetry:
apollo:
errors:
preview_extended_error_metrics: enabled
extended_error_metrics: enabled
subgraph:
all:
send: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
telemetry:
apollo:
errors:
preview_extended_error_metrics: enabled
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl IncompatiblePlugin for TelemetryIncompatPlugin {
self.config.subgraph.all.send
// When ExtendedErrorMetricsMode is enabled, this plugin supports reporting connector errors
&& !matches!(
self.config.preview_extended_error_metrics,
self.config.extended_error_metrics,
apollo::ExtendedErrorMetricsMode::Enabled
)
}
Expand All @@ -39,7 +39,7 @@ impl IncompatiblePlugin for TelemetryIncompatPlugin {
.partition_map(|(name, sub)| {
if sub.send
&& !matches!(
self.config.preview_extended_error_metrics,
self.config.extended_error_metrics,
apollo::ExtendedErrorMetricsMode::Enabled
)
{
Expand All @@ -61,13 +61,13 @@ impl IncompatiblePlugin for TelemetryIncompatPlugin {
if self.config.subgraph.subgraphs.contains_key(subgraph) {
tracing::warn!(
subgraph = subgraph,
message = "plugin `telemetry` is explicitly configured to send errors to Apollo studio for connector-enabled subgraph, which is only supported when `preview_extended_error_metrics` is enabled",
message = "plugin `telemetry` is explicitly configured to send errors to Apollo studio for connector-enabled subgraph, which is only supported when `extended_error_metrics` is enabled",
see = "https://go.apollo.dev/connectors/incompat",
);
} else {
tracing::info!(
subgraph = subgraph,
message = "plugin `telemetry` is indirectly configured to send errors to Apollo studio for a connector-enabled subgraph, which is only supported when `preview_extended_error_metrics` is enabled",
message = "plugin `telemetry` is indirectly configured to send errors to Apollo studio for a connector-enabled subgraph, which is only supported when `extended_error_metrics` is enabled",
see = "https://go.apollo.dev/connectors/incompat",
);
}
Expand Down
6 changes: 3 additions & 3 deletions apollo-router/src/plugins/telemetry/apollo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ pub(crate) struct ErrorsConfiguration {
pub(crate) subgraph: SubgraphErrorConfig,

/// Send error metrics via OTLP with additional dimensions [`extensions.service`, `extensions.code`]
pub(crate) preview_extended_error_metrics: ExtendedErrorMetricsMode,
pub(crate) extended_error_metrics: ExtendedErrorMetricsMode,
}

#[derive(Debug, Clone, Deserialize, JsonSchema, Default, PartialEq)]
Expand Down Expand Up @@ -326,10 +326,10 @@ impl SubgraphErrorConfig {
#[serde(deny_unknown_fields, rename_all = "lowercase")]
pub(crate) enum ExtendedErrorMetricsMode {
/// Do not send extended OTLP error metrics
#[default]
Disabled,
/// Send extended OTLP error metrics to Apollo Studio with additional dimensions [`extensions.service`, `extensions.code`].
/// If enabled, it's also recommended to enable `redaction_policy: extended` on subgraphs to send the `extensions.code` for subgraph errors.
#[default]
Enabled,
}

Expand Down Expand Up @@ -416,7 +416,7 @@ impl Default for Config {
signature_normalization_algorithm: ApolloSignatureNormalizationAlgorithm::default(),
experimental_local_field_metrics: false,
metrics_reference_mode: ApolloMetricsReferenceMode::default(),
subgraph_metrics: false,
subgraph_metrics: true,
sampler: None,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ info:
- user_api
- connector_source: name
---
- name: apollo.router.operations.fetch.duration
description: Duration of a subgraph fetch.
unit: s
data:
datapoints:
- sum: 0.1
count: 2
attributes:
connector.source: user_api
has_errors: false
subgraph.name: users
- name: not.found.count
description: Count of 404 responses from the user API
unit: count
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ info:
- user_api
- connector_source: name
---
- name: apollo.router.operations.fetch.duration
description: Duration of a subgraph fetch.
unit: s
data:
datapoints:
- sum: 0.1
count: 2
attributes:
connector.source: user_api
has_errors: false
subgraph.name: users
- name: rate.limit
description: Rate limit remaining
unit: count
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,21 @@ info:
custom.supergraph.operation.kind:
supergraph_operation_kind: string
custom.has_error:
error: boolean
snapshot_kind: text
connector_on_response_error: true
---
- name: apollo.router.operations.fetch.duration
description: Duration of a subgraph fetch.
unit: s
data:
datapoints:
- sum: 0.1
count: 1
attributes:
connector.source: posts_api
graphql.operation.name: Test
graphql.operation.type: query
has_errors: false
subgraph.name: posts
- name: http.client.request.duration
description: Duration of HTTP client requests.
unit: s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,18 @@ info:
connector_response_mapping_problems: boolean
unit: count
type: counter
snapshot_kind: text
---
- name: apollo.router.operations.fetch.duration
description: Duration of a subgraph fetch.
unit: s
data:
datapoints:
- sum: 0.1
count: 2
attributes:
connector.source: user_api
has_errors: false
subgraph.name: users
- name: request.mapping.problems
description: Count of connectors request mapping problems
unit: count
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ info:
attributes:
subgraph.name: true
---
- name: apollo.router.operations.fetch.duration
description: Duration of a subgraph fetch.
unit: s
data:
datapoints:
- sum: 0.1
count: 1
attributes:
connector.source: reviews_api
has_errors: false
subgraph.name: reviews
- sum: 0.1
count: 1
attributes:
has_errors: false
subgraph.name: products
- name: http.client.request.duration
description: Duration of HTTP client requests.
unit: s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ info:
supergraph.operation.name:
supergraph_operation_name: string
---
- name: apollo.router.operations.fetch.duration
description: Duration of a subgraph fetch.
unit: s
data:
datapoints:
- sum: 0.1
count: 1
attributes:
graphql.operation.name: Test
has_errors: false
subgraph.name: products
- name: apollo.router.response.cache
description: Response cache hit/miss operations at the subgraph level
unit: ops
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
---
source: apollo-router/src/plugins/telemetry/config_new/instruments.rs
description: Test server request body size metrics
description: Custom counter
expression: "&metrics.all()"
info:
telemetry:
instrumentation:
instruments:
router:
http.server.active_requests: false
http.server.request.duration: false
default_requirement_level: none
subgraph:
custom_counter:
description: count of requests
type: counter
unit: unit
value: unit
---
- name: apollo.router.operations.fetch.duration
description: Duration of a subgraph fetch.
unit: s
data:
datapoints:
- sum: 0.1
count: 1
attributes:
has_errors: false
subgraph.name: products
- name: custom_counter
description: count of requests
unit: unit
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
---
source: apollo-router/src/plugins/telemetry/config_new/instruments.rs
description: Test server request body size metrics
description: "Custom counter aborted request, the supergraph response didn't happen, but request should increment the metric on Drop."
expression: "&metrics.all()"
info:
telemetry:
instrumentation:
instruments:
router:
http.server.active_requests: false
http.server.request.duration: false
default_requirement_level: none
subgraph:
custom_counter:
description: count of requests
type: counter
unit: unit
value: unit
---
- name: apollo.router.operations.fetch.duration
description: Duration of a subgraph fetch.
unit: s
data:
datapoints:
- sum: 0.1
count: 1
attributes:
has_errors: false
subgraph.name: products
- name: custom_counter
description: count of requests
unit: unit
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
---
source: apollo-router/src/plugins/telemetry/config_new/instruments.rs
description: Test server request body size metrics
description: Custom counter that gets a value from a header
expression: "&metrics.all()"
info:
telemetry:
instrumentation:
instruments:
router:
http.server.active_requests: false
http.server.request.duration: false
default_requirement_level: none
subgraph:
custom_counter:
description: count of requests
type: counter
unit: unit
value:
request_header: count_header
subgraph_request_header: count_header
---
- name: apollo.router.operations.fetch.duration
description: Duration of a subgraph fetch.
unit: s
data:
datapoints:
- sum: 0.1
count: 1
attributes:
has_errors: false
subgraph.name: products
- name: custom_counter
description: count of requests
unit: unit
Expand Down
Loading