Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
271e4fe
Implement subscription end reason attribute
rohan-b99 Jan 30, 2026
fa9c653
Add docs
rohan-b99 Feb 2, 2026
bbcb1c1
Remove "complete" reason
rohan-b99 Feb 3, 2026
b9ce87b
Add end reasons for schema reloads and config reloads
rohan-b99 Feb 4, 2026
d3bb6a4
Add attribute for defer.end_reason
rohan-b99 Feb 6, 2026
22b1c4e
Merge branch 'dev' into rohan-b99/subscription-observability-heartbea…
rohan-b99 Feb 9, 2026
21ca659
Add changeset
rohan-b99 Feb 9, 2026
6069b79
Merge branch 'rohan-b99/subscription-observability-heartbeat-payload-…
rohan-b99 Feb 9, 2026
cfd3954
Store end reason in Multipart struct, set attribute in Drop impl
rohan-b99 Feb 11, 2026
b5da305
Make usage of detect_reload_end_reason clearer
rohan-b99 Feb 11, 2026
de446c9
Merge branch 'dev' into rohan-b99/subscription-observability-heartbea…
rohan-b99 Feb 12, 2026
6aadae3
Apply suggestions from code review
rohan-b99 Feb 12, 2026
a0c3010
Change gracefully -> successfully in docs + comments
rohan-b99 Feb 12, 2026
4975ff9
Add counters for subscription end reasons, rename stream_end to subgr…
rohan-b99 Feb 18, 2026
9a2fae0
Add metric for when a subscription request is rejected as the `max_op…
rohan-b99 Feb 19, 2026
594d24d
Merge branch 'dev' into rohan-b99/subscription-observability-heartbea…
rohan-b99 Feb 19, 2026
cf8e42e
Format
rohan-b99 Feb 19, 2026
2deda87
Apply style guide suggestions
rohan-b99 Feb 19, 2026
b7d34ff
Remove stream_end naming
rohan-b99 Feb 19, 2026
01b757e
Add `apollo.router.operations.subscriptions.ended.subgraph` and `apol…
rohan-b99 Feb 24, 2026
137b929
Merge branch 'dev' into rohan-b99/subscription-observability-heartbea…
rohan-b99 Feb 24, 2026
7058716
Merge branch 'dev' into rohan-b99/subscription-observability-heartbea…
rohan-b99 Feb 25, 2026
e7dd953
Add docs & update changelog
rohan-b99 Feb 25, 2026
86ee338
Merge branch 'dev' into rohan-b99/subscription-observability-heartbea…
rohan-b99 Mar 5, 2026
fcec115
Combine apollo.router.operations.subscriptions.<end_reason> counters …
rohan-b99 Mar 5, 2026
3b1d9a1
Combine limit/subgraph counters into apollo.router.operations.subscri…
rohan-b99 Mar 5, 2026
891192c
Clarify docs around deduplication and subscription.terminated/subgrap…
rohan-b99 Mar 5, 2026
e164b4d
Format
rohan-b99 Mar 5, 2026
9b8a187
Merge branch 'dev' into rohan-b99/subscription-observability-heartbea…
rohan-b99 Mar 13, 2026
c7db2f2
Merge branch 'dev' into rohan-b99/subscription-observability-heartbea…
rohan-b99 Mar 13, 2026
67525a0
Merge branch 'rohan-b99/subscription-observability-heartbeat-payload-…
rohan-b99 Mar 16, 2026
47549fb
Use `subgraph.name` instead of `subgraph.service.name` for consistency
rohan-b99 Mar 16, 2026
85d6689
Remove subgraph.name for global max_opened_subscriptions_limit_reached
rohan-b99 Mar 16, 2026
aba2ba0
Add comments explaining why metrics are not incremented if gql_stream…
rohan-b99 Mar 17, 2026
38e79dc
Add DeferEndReason::SubgraphError variant and set if errors exist or …
rohan-b99 Mar 18, 2026
da92217
Refactor end_reason subscription branch
rohan-b99 Mar 18, 2026
ec77bea
Fix lint issue
rohan-b99 Mar 18, 2026
4ffa2db
Allow configuration of subscription.terminated attributes
rohan-b99 Mar 19, 2026
48e0789
Merge branch 'dev' into rohan-b99/subscription-observability-heartbea…
rohan-b99 Mar 19, 2026
77a9542
Format
rohan-b99 Mar 19, 2026
e530e72
Merge branch 'rohan-b99/subscription-observability-heartbeat-payload-…
rohan-b99 Mar 19, 2026
a9136d3
Update apollo_router__configuration__tests__schema_generation.snap
rohan-b99 Mar 19, 2026
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
### Add `apollo.subscription.end_reason` and `apollo.defer.end_reason` attributes to router spans ([PR #8858](https://github.com/apollographql/router/pull/8858))

Adds two new span attributes that indicate why a streaming response (subscription or defer) ended:

- **`apollo.subscription.end_reason`**: Records the reason a subscription was terminated. Possible values are `server_close`, `stream_end`, `heartbeat_delivery_failed`, `client_disconnect`, `schema_reload`, and `config_reload`.
- **`apollo.defer.end_reason`**: Records the reason a deferred query ended. Possible values are `completed` (all deferred chunks were delivered successfully) and `client_disconnect` (the client disconnected before all deferred data was delivered).

Both attributes are added dynamically to router spans only when relevant (i.e., only on requests that actually use subscriptions or `@defer`), rather than being present on every router span.

By [@rohan-b99](https://github.com/rohan-b99) in https://github.com/apollographql/router/pull/8858
4 changes: 2 additions & 2 deletions apollo-router/src/plugins/subscription/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ use crate::services::execution;
use crate::services::execution::QueryPlan;
use crate::services::subgraph::BoxGqlStream;

const SUBSCRIPTION_CONFIG_RELOAD_EXTENSION_CODE: &str = "SUBSCRIPTION_CONFIG_RELOAD";
const SUBSCRIPTION_SCHEMA_RELOAD_EXTENSION_CODE: &str = "SUBSCRIPTION_SCHEMA_RELOAD";
pub(crate) const SUBSCRIPTION_CONFIG_RELOAD_EXTENSION_CODE: &str = "SUBSCRIPTION_CONFIG_RELOAD";
pub(crate) const SUBSCRIPTION_SCHEMA_RELOAD_EXTENSION_CODE: &str = "SUBSCRIPTION_SCHEMA_RELOAD";
const SUBSCRIPTION_JWT_EXPIRED_EXTENSION_CODE: &str = "SUBSCRIPTION_JWT_EXPIRED";
const SUBSCRIPTION_EXECUTION_ERROR_EXTENSION_CODE: &str = "SUBSCRIPTION_EXECUTION_ERROR";

Expand Down
2 changes: 2 additions & 0 deletions apollo-router/src/plugins/subscription/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ pub(crate) mod notification;
pub(crate) mod subgraph;

pub(crate) use callback::SUBSCRIPTION_CALLBACK_HMAC_KEY;
pub(crate) use execution::SUBSCRIPTION_CONFIG_RELOAD_EXTENSION_CODE;
pub(crate) use execution::SUBSCRIPTION_SCHEMA_RELOAD_EXTENSION_CODE;
pub(crate) use execution::SubscriptionExecutionLayer;
pub(crate) use execution::SubscriptionTaskParams;
pub(crate) use fetch::fetch_service_handle_subscription;
Expand Down
4 changes: 2 additions & 2 deletions apollo-router/src/plugins/telemetry/span_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl SpanMode {
"otel.status_code" = ::tracing::field::Empty,
"apollo_private.duration_ns" = ::tracing::field::Empty,
"apollo_private.http.request_headers" = ::tracing::field::Empty,
"apollo_private.http.response_headers" = ::tracing::field::Empty
"apollo_private.http.response_headers" = ::tracing::field::Empty,
);
span
}
Expand Down Expand Up @@ -163,7 +163,7 @@ impl SpanMode {
apollo_private.graphql.variables = Telemetry::filter_variables_values(
&request.supergraph_request.body().variables,
&send_variable_values,
)
),
)
}
}
Expand Down
Loading