-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fix error reporting when trace data is not included #7136
Conversation
✅ Deploy Preview for apollo-server-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 5548ec0:
|
dff19ff
to
78863f6
Compare
update CS:CI config to build missing packages
4a5ae68
to
9efb148
Compare
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 broad structure here seems good but the tests suggest there's a bug preventing the fix from working. (Maybe the version of gateway loaded is wrong?)
Also I'm sure you know this but a ton more comments would be helpful, both about the new stuff and about the other stuff we've discovered today that wasn't obvious.
package.json
Outdated
@@ -39,7 +39,9 @@ | |||
}, | |||
"devDependencies": { | |||
"@apollo/client": "3.7.1", | |||
"@apollo/gateway": "https://pkg.csb.dev/apollographql/federation/commit/ca4c450d/@apollo/gateway", |
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.
reminder to fix this. (is there a circular dependency issue where we can't publish one until the other is done and vice versa? this is just for tests though right?)
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 "correct" way to do this would be publish gateway interface -> gateway -> server, but yes it is just tests.
packages/server/src/__tests__/plugin/usageReporting/statsErrors.test.ts
Outdated
Show resolved
Hide resolved
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.
Other than those minor notes this looks good. The PR title/description could use an update to describe this kinda subtle issue, and also a changeset.
Precursor to: #7136 apollographql/federation#2242 This interface needs to be published in order to properly land and publish the required change to gateway, which the Apollo Server change depends on.
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @apollo/server-gateway-interface@1.1.0 ### Minor Changes - [#7325](#7325) [`e0f959a63`](e0f959a) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Add optional `nonFtv1ErrorPaths` to Gateway metrics data. This change is a prerequisite to: - <apollographql/federation#2242> - <#7136> ## @apollo/server-integration-testsuite@4.3.2 ### Patch Changes - [#7316](#7316) [`37d884650`](37d8846) Thanks [@renovate](https://github.com/apps/renovate)! - Update graphql-http dependency - Updated dependencies \[[`f246ddb71`](f246ddb), [`e25cb58ff`](e25cb58)]: - @apollo/server@4.3.2 ## @apollo/server@4.3.2 ### Patch Changes - [#7314](#7314) [`f246ddb71`](f246ddb) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Add an `__identity` property to `HeaderMap` class to disallow standard `Map`s (in TypeScript). This ensures that typechecking occurs on fields which are declared to accept a `HeaderMap` (notably, the `httpGraphQLRequest.headers` option to `ApolloServer.executeHTTPGraphQLRequest` and the `http.headers` option to `ApolloServer.executeOperation`). This might be a breaking change for integration authors, but should be easily fixed by switching from `new Map<string, string>()` to `new HeaderMap()`. - [#7326](#7326) [`e25cb58ff`](e25cb58) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Pin `node-abort-controller` version to avoid breaking change. Apollo Server users can enter a broken state if they update their package-lock.json due to a breaking change in a minor release of the mentioned package. Ref: <southpolesteve/node-abort-controller#39> - Updated dependencies \[[`e0f959a63`](e0f959a)]: - @apollo/server-gateway-interface@1.1.0 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit precedes apollographql/apollo-server#7136 For the mentioned PR (full context within), the gateway needs to capture error information from subgraphs with no trace data separately and report them within the metrics object that's shared with the inline trace plugin. This change only takes effect for subgraphs with no ftv1 support or when fieldLevelInstrumentation on the inline trace plugin is set to 0 or returns 0.
'@apollo/server': patch | ||
--- | ||
|
||
Errors reported by subgraphs (with no trace data in the response) are now accurately reflected in the numeric error stats. |
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.
Does this changeset (and PR description) need to note that a particular version of Gateway is also needed to have the issue be actually fixed?
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.
Added in e1b8122 (with a FIXME to plug in final gateway version)
package.json
Outdated
@@ -38,7 +38,9 @@ | |||
}, | |||
"devDependencies": { | |||
"@apollo/client": "3.7.5", | |||
"@apollo/gateway": "https://pkg.csb.dev/apollographql/federation/commit/166fdd24/@apollo/gateway", |
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.
Would be nice to avoid this but I guess the gateway release process is slow.
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 will become the actual gateway version once the patch is released, won't land this until then
package.json
Outdated
"@apollo/server-plugin-landing-page-graphql-playground": "4.0.0", | ||
"@apollo/subgraph": "https://pkg.csb.dev/apollographql/federation/commit/166fdd24/@apollo/subgraph", |
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.
Why is this needed?
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.
Probably could've always been just the current version of subgraph but this will be latest once the patch release is published
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @apollo/server-integration-testsuite@4.3.3 ### Patch Changes - [#7338](#7338) [`01bc39838`](01bc398) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Update graphql-http to 1.13.0 - Updated dependencies \[[`9de18b34c`](9de18b3), [`8c635d104`](8c635d1)]: - @apollo/server@4.3.3 ## @apollo/server@4.3.3 ### Patch Changes - [#7331](#7331) [`9de18b34c`](9de18b3) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Unpin `node-abort-controller` and update to latest unbreaking patch - [#7136](#7136) [`8c635d104`](8c635d1) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Errors reported by subgraphs (with no trace data in the response) are now accurately reflected in the numeric error stats. Operations that receive errors from subgraphs (with no trace data in the response) are no longer sent as incomplete, error-less traces. Note: in order for this fix to take effect, your `@apollo/gateway` version must be updated to v2.3.1 or later. Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This is a 2-part change which requires an update to the gateway runtime as well. Related PR: apollographql/federation#2242
It was brought to our attention that trace information w.r.t. subgraph errors is incorrect in the case that there is no trace in the subgraph response (i.e. no ftv1 support in the subgraph or
fieldLevelInstrumentation
is 0 or returns 0).With this change:
The gateway change now collects errors separately when no trace data is found and passes that error information (subgraph and error path) along with the other metrics data for the plugin to consume. The plugin uses the subgraph name and error path in order to add error stat information to the tree.