Adding context_id support to selectors#8899
Conversation
Adding support for supplying context_id through selectors
✅ Docs preview has no changesThe preview was not built because there were no changes. Build ID: b9ebe0eb107a4023b0195637 ✅ AI Style Review — No Changes DetectedNo MDX files were changed in this pull request. Review Log: View detailed log
|
This comment has been minimized.
This comment has been minimized.
|
do we also want context IDs to be selectable from connectors? |
carodewig
left a comment
There was a problem hiding this comment.
Overall looks good! A few comments / style suggestions below but the approach makes sense to me
|
|
||
| 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. |
There was a problem hiding this comment.
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?
Making some style changes based on suggestions in the PR
carodewig
left a comment
There was a problem hiding this comment.
Final nitpick / style suggestion but otherwise LGTM!
sachindshinde
left a comment
There was a problem hiding this comment.
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!
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.
Exceptions
Note any exceptions here
Notes
Footnotes
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. ↩
Configuration is an important part of many changes. Where applicable please try to document configuration examples. ↩
A lot of (if not most) features benefit from built-in observability and
debug-level logs. Please read this guidance on metrics best-practices. ↩Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions. ↩