-
Notifications
You must be signed in to change notification settings - Fork 244
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
add support of chunk responses for selectors and instrument in telemetry #5022
Merged
Merged
Changes from 18 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
6db5b02
add support of chunk responses for selectors and instrument in telemetry
bnjjj c357a08
Merge branch 'dev' of github.com:apollographql/router into bnjjj/feat…
bnjjj ce224f9
rename trait method and configuration
bnjjj 539cbe7
update json schema
bnjjj 75ff672
add support for error selectors and add more tests for event_response
bnjjj adeb7c8
fix lints
bnjjj e8d8b5d
add changelog
bnjjj 0aa4a67
some fixes
bnjjj e9387f4
Merge branch 'dev' of github.com:apollographql/router into bnjjj/feat…
bnjjj d13c0eb
update json schema
bnjjj c3d6034
Merge branch 'dev' of github.com:apollographql/router into bnjjj/feat…
bnjjj dfcff47
Merge branch 'dev' into bnjjj/feat_chunk_resp_selector
bnjjj d9afda6
fix bugs and add more tests for cost and event
bnjjj ae2f437
add a new test + a fix
bnjjj 23580ec
fix counter
bnjjj d753b7d
oops
bnjjj a64d91c
Merge branch 'dev' of github.com:apollographql/router into bnjjj/feat…
bnjjj 4e3d05b
don't keep the lock too long
bnjjj 82b0d3e
don't keep the lock too long
bnjjj b456548
Merge branch 'dev' of github.com:apollographql/router into bnjjj/feat…
bnjjj 152c279
rename on_event_response to on_response_event
bnjjj c097e38
update description for event instruments
bnjjj 43c959e
Merge branch 'dev' of github.com:apollographql/router into bnjjj/feat…
bnjjj File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
### Add support of event responses and critical errors for selectors and instrument in telemetry ([Issue #5027](https://github.com/apollographql/router/issues/5027)) | ||
|
||
Giving the ability to compute new attributes everytime we receive a new event in supergraph response. Would be really helpful to create observability for subscriptions and defer. | ||
|
||
I also added the support of `on_error` for selectors and especially `error` selector I added for every services. Which will let you create some metrics,events or span attributes containing error message. By adding this we will now have to ability to create a counter of request timed out for subgraphs for example: | ||
|
||
```yaml | ||
telemetry: | ||
instrumentation: | ||
instruments: | ||
subgraph: | ||
requests.timeout: | ||
value: unit | ||
type: counter | ||
unit: request | ||
description: "subgraph requests containing subgraph timeout" | ||
attributes: | ||
subgraph.name: true | ||
condition: | ||
eq: | ||
- "request timed out" | ||
- error: reason | ||
``` | ||
|
||
And thanks to the event support for selectors you'll be able to fetch data directly from the supergraph response body: | ||
|
||
```yaml | ||
telemetry: | ||
instrumentation: | ||
instruments: | ||
acme.request.on_graphql_error: | ||
value: event_unit | ||
type: counter | ||
unit: error | ||
description: my description | ||
condition: | ||
eq: | ||
- MY_ERROR_CODE | ||
- response_errors: "$.[0].extensions.code" | ||
attributes: | ||
response_errors: | ||
response_errors: "$.*" | ||
``` | ||
|
||
By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/5022 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This throws me off a bit, intuitively I read that as multipart file upload chunks. Also does this actually apply only to http multipart /responses/ ?
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.
Hmm not really, I don't know how to explain it better because it's highly related to our internals. It's basically event coming in the supergraph response stream. Maybe a better description could be
For every supergraph response payload (including subscription events and defer events)
?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.
cc @shorgi WDYT?
I'm going to preapprove the PR and let Edward give his opinion / suggest something :D
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.
@bnjjj I like your updated suggestion.
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.
I updated with my suggestion and enable auto merge in order to have this in the next release. Once we have feedback from @shorgi I'll open a new PR to change the description