Skip to content
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

Capture non-ftv1 errors in metrics #2242

Merged
merged 3 commits into from
Jan 25, 2023
Merged

Conversation

trevor-scheer
Copy link
Member

@trevor-scheer trevor-scheer commented Nov 9, 2022

This PR accompanies 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.

@netlify
Copy link

netlify bot commented Nov 9, 2022

Deploy Preview for apollo-federation-docs canceled.

Name Link
🔨 Latest commit 6d7bf33
🔍 Latest deploy log https://app.netlify.com/sites/apollo-federation-docs/deploys/63d1a19cb1988900081b69ba

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 9, 2022

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.

@changeset-bot
Copy link

changeset-bot bot commented Jan 24, 2023

🦋 Changeset detected

Latest commit: 6d7bf33

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@apollo/gateway Patch
@apollo/federation-internals Patch
@apollo/composition Patch
@apollo/query-planner Patch
@apollo/query-graphs Patch
@apollo/subgraph Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@trevor-scheer trevor-scheer force-pushed the trevor/usage-reporting-errors branch 2 times, most recently from 4284324 to 61ac1e5 Compare January 24, 2023 22:27
trevor-scheer added a commit to apollographql/apollo-server that referenced this pull request Jan 25, 2023
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.
trevor-scheer pushed a commit to apollographql/apollo-server that referenced this pull request Jan 25, 2023
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>
@trevor-scheer trevor-scheer changed the title WIP: capture non-ftv1 errors in metrics Capture non-ftv1 errors in metrics Jan 25, 2023
@trevor-scheer trevor-scheer marked this pull request as ready for review January 25, 2023 21:34
trevor-scheer added a commit to apollographql/apollo-server that referenced this pull request Feb 6, 2023
This is a 2-part change which required 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:
* 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

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.

In order to make use of this fix, you must be using the latest gateway patch
`@apollo/gateway@2.3.1` in tandem with this change.
<!--
First, 🌠 thank you 🌠 for taking the time to consider a contribution to
Apollo!

Here are some important details to follow:

* ⏰ Your time is important
To save your precious time, if the contribution you are making will take
more
than an hour, please make sure it has been discussed in an issue first.
          This is especially true for feature requests!
* 💡 Features
Feature requests can be created and discussed within a GitHub Issue. Be
sure to search for existing feature requests (and related issues!) prior
to
opening a new request. If an existing issue covers the need, please
upvote
that issue by using the 👍 emote, rather than opening a new issue.
* 🔌 Integrations
Apollo Server has many web-framework integrations including Express,
Koa,
Hapi and more. When adding a new feature, or fixing a bug, please take a
peak and see if other integrations are also affected. In most cases, the
fix can be applied to the other frameworks as well. Please note that,
since new web-frameworks have a high maintenance cost, pull-requests for
new web-frameworks should be discussed with a project maintainer first.
* 🕷 Bug fixes
These can be created and discussed in this repository. When fixing a
bug,
please _try_ to add a test which verifies the fix. If you cannot, you
should
still submit the PR but we may still ask you (and help you!) to create a
test.
* 📖 Contribution guidelines
Follow
https://github.com/apollographql/apollo-server/blob/main/CONTRIBUTING.md
when submitting a pull request. Make sure existing tests still pass, and
add
          tests for all new behavior.
* ✏️ Explain your pull request
Describe the big picture of your changes here to communicate to what
your
pull request is meant to accomplish. Provide 🔗 links 🔗 to associated
issues!

We hope you will find this to be a positive experience! Open source
contribution can be intimidating and we hope to alleviate that pain as
much as possible. Without following these guidelines, you may be missing
context that can help you succeed with your contribution, which is why
we encourage discussion first. Ultimately, there is no guarantee that we
will be able to merge your pull-request, but by following these
guidelines we can try to avoid disappointment.
-->
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.

2 participants