Skip to content

Adding context_id support to selectors#8899

Merged
BobaFetters merged 17 commits intodevfrom
fix/graphos-67
Mar 24, 2026
Merged

Adding context_id support to selectors#8899
BobaFetters merged 17 commits intodevfrom
fix/graphos-67

Conversation

@BobaFetters
Copy link
Copy Markdown
Member

@BobaFetters BobaFetters commented Feb 18, 2026

Adding support for supplying context_id through selectors

Addresses GRAPHOS-67


Checklist

Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.

  • PR description explains the motivation for the change and relevant context for reviewing
  • PR description links appropriate GitHub/Jira tickets (creating when necessary)
  • Changeset is included for user-facing changes
  • Changes are compatible1
  • Documentation2 completed
  • Performance impact assessed and acceptable
  • Metrics and logs are added3 and documented
  • Tests added and passing4
    • Unit tests
    • Integration tests
    • Manual tests, as necessary

Exceptions

Note any exceptions here

Notes

Footnotes

  1. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this.

  2. Configuration is an important part of many changes. Where applicable please try to document configuration examples.

  3. A lot of (if not most) features benefit from built-in observability and debug-level logs. Please read this guidance on metrics best-practices.

  4. Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

Adding support for supplying context_id through selectors
@BobaFetters BobaFetters self-assigned this Feb 18, 2026
@BobaFetters BobaFetters requested a review from a team as a code owner February 18, 2026 21:27
@apollo-librarian
Copy link
Copy Markdown
Contributor

apollo-librarian bot commented Feb 18, 2026

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: b9ebe0eb107a4023b0195637
Build Logs: View logs


✅ AI Style Review — No Changes Detected

No MDX files were changed in this pull request.

Review Log: View detailed log

This review is AI-generated. Please use common sense when accepting these suggestions, as they may not always be accurate or appropriate for your specific context.

@github-actions

This comment has been minimized.

@aaronArinder
Copy link
Copy Markdown
Contributor

do we also want context IDs to be selectable from connectors?

@BobaFetters BobaFetters requested a review from a team as a code owner February 25, 2026 08:08
Copy link
Copy Markdown
Contributor

@carodewig carodewig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good! A few comments / style suggestions below but the approach makes sense to me

Comment thread .changesets/feat_context_id_selector.md Outdated
Comment thread apollo-router/src/plugins/coprocessor/test.rs Outdated
Comment thread apollo-router/src/plugins/headers/mod.rs Outdated
Comment thread .changesets/feat_context_id_selector.md Outdated

A new `context_id` selector is now available for router, supergraph, subgraph, and connector telemetry instrumentation. This selector exposes the unique per-request context ID that can be used to reliably correlate and debug requests in traces, logs, and custom events.

Previously, the context ID was only accessible via Rhai scripts as `request.id`, but Rhai runs after telemetry, preventing its use in telemetry attributes. With this change, users can now include the context ID in spans and other telemetry data.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite follow this - I would think the lack of a selector was what was preventing the use of the context ID in telemetry?

Copy link
Copy Markdown
Contributor

@carodewig carodewig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final nitpick / style suggestion but otherwise LGTM!

Comment thread apollo-router/src/plugins/telemetry/config_new/subgraph/selectors.rs Outdated
@BobaFetters BobaFetters requested a review from carodewig March 12, 2026 15:52
Copy link
Copy Markdown
Contributor

@carodewig carodewig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Contributor

@sachindshinde sachindshinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners-wise our team only owns apollo-router/src/plugins/connectors/handle_responses.rs, and those changes and adjacent changes seem fine to me (looks like it's cloning the context on through to the response for telemetry selection, and the context seems cheap enough to clone). If there's something specific you want us to review, let us know and we can give it a look!

@BobaFetters BobaFetters merged commit 97588ac into dev Mar 24, 2026
15 checks passed
@BobaFetters BobaFetters deleted the fix/graphos-67 branch March 24, 2026 18:02
@abernix abernix mentioned this pull request Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants