-
Notifications
You must be signed in to change notification settings - Fork 324
feature: Adds common transport for Client Awareness and Enhanced Client Awareness metadata #8503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
✅ Docs preview has no changesThe preview was not built because there were no changes. Build ID: 1eab6ad149a2879ed83e5e26 |
This comment has been minimized.
This comment has been minimized.
1b34917 to
bfbb873
Compare
| @@ -0,0 +1,5 @@ | |||
| ### ([PR #8503](https://github.com/apollographql/router/pull/8503)) | |||
|
|
|||
| Supporting a common transport mechanism for the Client Awareness and Enhanced Client Awareness values is more efficient than the current split between HTTP header (for Client Awareness) and `request.extensions` for Enhanced Client Awareness. This changeset allows clients to send both sets of values using the same method. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: which one 'wins' if for instance clientLibrary is provided both in headers and in extensions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My assumption is the extensions plugin would overwrite any header values but I'm not certain; I'd need to check the order of request processing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circling back to this - I believe my assumption is correct.
- Looking at the request lifecycle detailed in the Router docs the router service is before the supergraph service.
- The telemetry plugin is registered for interaction with many services but the one that handles the client name/version extraction is in the router service logic - here
- The enhanced client awareness plugin in registered only for interaction with the supergraph service - here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for confirming. I guess it should be documented somewhere (not sure where!) to avoid any mixup.
|
@apollographql/router-core, @bonnici - would love a review on this PR when you get a free moment please, thank you. |
...uter/src/configuration/snapshots/apollo_router__configuration__tests__schema_generation.snap
Show resolved
Hide resolved
...uter/src/configuration/snapshots/apollo_router__configuration__tests__schema_generation.snap
Show resolved
Hide resolved
...uter/src/configuration/snapshots/apollo_router__configuration__tests__schema_generation.snap
Show resolved
Hide resolved
bonnici
left a comment
There was a problem hiding this 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
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.
Thanks for the prompt about the docs. I'll get those updated. |
|
@bonnici, looking into the documentation now is making me question whether customers that choose to send client name and version via 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? |
|
Putting this PR back into 'draft' while I update the documentation and figure out the trace report questions.. |
|
I'll need to look into this tomorrow. |
|
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. |
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, orrequest.extensions.This PR enables that:
enhanced_client_awarenessplugin now looks for client name/version and adds it to the request context and those values get sent off in the metrics report.telemetryplugin now looks for the library name/version and adds it to the request context and those values get sent off in the metrics report.https://apollographql.atlassian.net/browse/ROUTER-1520
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. ↩