Skip to content

feature: Adds common transport for Client Awareness and Enhanced Client Awareness metadata#8503

Merged
calvincestari merged 22 commits intodevfrom
feature/client-awareness-common-transport
Dec 19, 2025
Merged

feature: Adds common transport for Client Awareness and Enhanced Client Awareness metadata#8503
calvincestari merged 22 commits intodevfrom
feature/client-awareness-common-transport

Conversation

@calvincestari
Copy link
Member

@calvincestari calvincestari commented Oct 28, 2025

At the moment we have a split between two closely related features; the Client Awareness feature is activated through HTTP headers, whereas Enhanced Client Awareness is activated through request.extensions. The long-term goal for these two has always been to enable a common transport for them. So that they can both be sent via HTTP headers, or request.extensions.

This PR enables that:

  • The enhanced_client_awareness plugin now looks for client name/version and adds it to the request context and those values get sent off in the metrics report. This cannot be done because of the timing of trace report generation and sending. The request extensions map is only available post-HTTP processing at which point the trace report has already started and the client identified, doing that in the enhanced_client_awareness plugin is too late and breaks trace reports.
  • The telemetry plugin now looks for the library name/version, adds it to the request context, and those values get sent off in the metrics report.

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.

@apollo-librarian
Copy link

apollo-librarian bot commented Oct 28, 2025

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: 05f197fa31a2af92ca3f2058
Build Logs: View logs

@github-actions

This comment has been minimized.

@calvincestari calvincestari force-pushed the feature/client-awareness-common-transport branch from 1b34917 to bfbb873 Compare October 30, 2025 17:47
@calvincestari calvincestari marked this pull request as ready for review November 6, 2025 01:04
@calvincestari calvincestari requested a review from a team November 6, 2025 01:04
@calvincestari calvincestari requested a review from a team as a code owner November 6, 2025 01:04
@calvincestari calvincestari requested a review from bonnici November 6, 2025 01:04
@calvincestari
Copy link
Member Author

@apollographql/router-core, @bonnici - would love a review on this PR when you get a free moment please, thank you.

Copy link
Contributor

@bonnici bonnici left a comment

Choose a reason for hiding this comment

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

The changes look good to me, but from memory the reason we went with using request.extensions was to make it hard for people to modify the library name and version. Adding user-configurable options for deciding which header values to use for this seems to go against that goal. But if we've decided that this is the way we want to go, we should also update the docs here: https://www.apollographql.com/docs/graphos/routing/observability/router-telemetry-otel/enabling-telemetry/usage-guides/client-id-enforcement

@calvincestari
Copy link
Member Author

The changes look good to me, but from memory the reason we went with using request.extensions was to make it hard for people to modify the library name and version. Adding user-configurable options for deciding which header values to use for this seems to go against that goal.

It wasn't necessarily to make it more difficult but rather that using HTTP headers and being on-by-default would have negative consequences for web applications re. CORS. All clients offer a way to disable sending the library values but use hard-coded values, so the only way for an app to modify the values would be to modify the request after it has been composed.

This change now is to clean up the inefficient split sending methods in use today and support a couple recent use cases.

But if we've decided that this is the way we want to go, we should also update the docs here: https://www.apollographql.com/docs/graphos/routing/observability/router-telemetry-otel/enabling-telemetry/usage-guides/client-id-enforcement

Thanks for the prompt about the docs. I'll get those updated.

@calvincestari
Copy link
Member Author

calvincestari commented Nov 10, 2025

@bonnici, looking into the documentation now is making me question whether customers that choose to send client name and version via request.extensions would be losing trace data? I say this because the changes I've made ensure that the metrics report gets the values regardless of where they originate from (headers vs. extensions) but I haven't accounted for the missing trace report values if they aren't in the http header.

The section titled "Why enforce client reporting?" lists a few items and I'm not certain of where they are derived from: client field usage; traffic patterns; and operation-level observability. Do you know which of those are derived from traces vs. metrics?

@calvincestari
Copy link
Member Author

Putting this PR back into 'draft' while I update the documentation and figure out the trace report questions..

@calvincestari calvincestari marked this pull request as draft November 10, 2025 23:08
@bonnici
Copy link
Contributor

bonnici commented Nov 12, 2025

I'll need to look into this tomorrow.

@calvincestari
Copy link
Member Author

calvincestari commented Nov 12, 2025

I'm going to add test for client name/version via request extensions + trace report, so I'll have to get that logic path working too.

Not possible, see description.

@calvincestari calvincestari force-pushed the feature/client-awareness-common-transport branch from 994fbc4 to 8ba33e8 Compare December 16, 2025 22:52
@calvincestari calvincestari marked this pull request as ready for review December 17, 2025 00:23
@calvincestari calvincestari force-pushed the feature/client-awareness-common-transport branch from 26f0343 to 6c8a652 Compare December 18, 2025 20:12
@calvincestari calvincestari force-pushed the feature/client-awareness-common-transport branch from 6c8a652 to a1090a6 Compare December 18, 2025 20:37
@calvincestari
Copy link
Member Author

@bonnici - I've removed the client name/version handling from enhanced_client_awareness plugin so now the only change in this PR is handling library name/version when they are sent as HTTP headers.

It would be great if you could please give this another quick glance over before I merge it - thanks.

Copy link
Contributor

@bonnici bonnici left a comment

Choose a reason for hiding this comment

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

Looks good! I tested a request with client name/version in headers on a router running locally and the name/version got set properly in the trace payload. If you want to check the dev data lake you should see a request for the QueryHeadersOnly operation with the library name and version set.

@calvincestari calvincestari enabled auto-merge (squash) December 19, 2025 17:23
@calvincestari calvincestari merged commit a4b4cb7 into dev Dec 19, 2025
14 of 15 checks passed
@calvincestari calvincestari deleted the feature/client-awareness-common-transport branch December 19, 2025 17:25
briannafugate408 pushed a commit that referenced this pull request Jan 9, 2026
@abernix abernix mentioned this pull request Jan 27, 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