Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BE-308] Federated metrics support (#2900)
* [BE-308] Federated metrics support Augments apollo-engine-reporting and @apollo/gateway to provide federated metrics to Engine from the gateway. Extend trace reports to contain a QueryPlan tree when traces are received from a gateway, mimicking the query plan that the gateway makes internally. FetchNodes on the tree correspond to GraphQL operations executed against federated services; each FetchNode contains its own tree of Trace.Nodes. - apollo-engine-reporting - Factor out core tree building logic to EngineReportingTreeBuilder class - New EngineFederatedTracingExtension adds a base64-encoded protobuf of a Trace (with just the node tree and top level timestamps) to an extension on federated service responses (if requested to do so via an HTTP header from gateway). - Implement new originalFieldName trace field (similar goal to #2401, BE-158). - If @apollo/gateway built us a query plan trace, add it to the trace - @apollo/gateway - Builds up a protobuf representation of the query plan, including sub-traces from federated services on FetchNodes - apollo-engine-reporting-protobuf - Copy reports.proto from internal repo - Set editorconfig settings to match internal repo - Always use normal numbers, not long.js objects - apollo-server-core - Thread some data through between reporting and gateway modules. - apollo-server-integration-testsuite - Clean up some ts warnings TODO record __resolveReference as multiple nodes? TODO is it actually OK to include the operation text in fetch trace nodes? TODO more tests, especially of error cases TODO internal docs (eg FIXME comment in reports.proto) TODO external docs * Update protobuf to match cloud repo * No longer set nonexistent operation field * Update proto to fix typo * Convert trace failure into metric Previously, the logic within executing a query plan would throw an error and fail the entire operation if it could not parse a trace. Instead, it adds the information that it failed to parse the trace into the overall fetch node itself. This commit also adds some comments. * add snapshot-serializer test * Add to comment justifying console.warn * update snapshot * prettier * Fixup some imports Build still breaking :( * Rely on serviceName instead of error code We used to rely on the error code matching "DOWNSTREAM_SERVICE_ERROR" in order to determine that an error was from an underlying service rather than from the gateway itself. In the past few weeks, error handling in the gateway has been modified to allow for overriding this error code with whatever code has come from the gateway, but we are guaranteed to always have a serviceName if the error comes from a downstream service. Note, however, that this means if users pass "serviceName" in an error extension, it will NOT be reported for metrics, even if it occurred at the Gateway level. We may want to find something less flimsy than this. * lint fix * Remove invalid null arguments * Take suggested log changes * Publish - apollo-cache-control@0.7.6-alpha.10 - apollo-datasource-rest@0.5.2-alpha.1 - apollo-engine-reporting-protobuf@0.3.2-alpha.0 - apollo-engine-reporting@1.4.0-alpha.10 - @apollo/federation@0.6.11-alpha.10 - @apollo/gateway@0.7.0-alpha.10 - apollo-server-azure-functions@2.7.0-alpha.10 - apollo-server-cloud-functions@2.7.0-alpha.10 - apollo-server-cloudflare@2.7.0-alpha.10 - apollo-server-core@2.7.0-alpha.10 - apollo-server-express@2.7.0-alpha.10 - apollo-server-fastify@2.7.0-alpha.10 - apollo-server-hapi@2.7.0-alpha.10 - apollo-server-integration-testsuite@2.7.0-alpha.10 - apollo-server-koa@2.7.0-alpha.10 - apollo-server-lambda@2.7.0-alpha.10 - apollo-server-micro@2.7.0-alpha.10 - apollo-server-plugin-base@0.6.0-alpha.10 - apollo-server-plugin-response-cache@0.2.7-alpha.10 - apollo-server-testing@2.7.0-alpha.10 - apollo-server-types@0.1.1-alpha.1 - apollo-server@2.7.0-alpha.10 - apollo-tracing@0.7.5-alpha.10 - graphql-extensions@0.8.0-alpha.10 * empty commit * Publish - apollo-server-azure-functions@2.7.0-alpha.11 - apollo-server-cloud-functions@2.7.0-alpha.11 - apollo-server-cloudflare@2.7.0-alpha.11 - apollo-server-express@2.7.0-alpha.11 - apollo-server-fastify@2.7.0-alpha.11 - apollo-server-hapi@2.7.0-alpha.11 - apollo-server-integration-testsuite@2.7.0-alpha.11 - apollo-server-koa@2.7.0-alpha.11 - apollo-server-lambda@2.7.0-alpha.11 - apollo-server-micro@2.7.0-alpha.11 - apollo-server-testing@2.7.0-alpha.11 - apollo-server@2.7.0-alpha.11 * anotha one * Publish - apollo-server-azure-functions@2.7.0-alpha.12 - apollo-server-cloud-functions@2.7.0-alpha.12 - apollo-server-cloudflare@2.7.0-alpha.12 - apollo-server-express@2.7.0-alpha.12 - apollo-server-fastify@2.7.0-alpha.12 - apollo-server-hapi@2.7.0-alpha.12 - apollo-server-integration-testsuite@2.7.0-alpha.12 - apollo-server-koa@2.7.0-alpha.12 - apollo-server-lambda@2.7.0-alpha.12 - apollo-server-micro@2.7.0-alpha.12 - apollo-server-testing@2.7.0-alpha.12 - apollo-server@2.7.0-alpha.12
- Loading branch information
Showing
43 changed files
with
1,582 additions
and
347 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
12 changes: 12 additions & 0 deletions
12
packages/apollo-engine-reporting-protobuf/src/.editorconfig
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,12 @@ | ||
# reports.proto is copied from an internal Apollo repository which applies these | ||
# editorconfig standards. | ||
|
||
root = true | ||
|
||
[reports.proto] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = tab | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
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
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.