Skip to content

Commit

Permalink
Update protobuf (#7411)
Browse files Browse the repository at this point in the history
Update protobuf to latest, which notably introduces a `ConditionNode`
needed to reintroduce support for `@skip`/`@include` in gateway traces.

These changes were produced by running the following:
```sh
npm run update-proto -w @apollo/usage-reporting-protobuf
npm run generate -w @apollo/usage-reporting-protobuf
```
  • Loading branch information
trevor-scheer committed Mar 2, 2023
1 parent 8177acc commit 021460e
Show file tree
Hide file tree
Showing 9 changed files with 3,144 additions and 515 deletions.
5 changes: 5 additions & 0 deletions .changeset/violet-olives-doubt.md
@@ -0,0 +1,5 @@
---
'@apollo/usage-reporting-protobuf': minor
---

Update protobuf which includes updates for supporting (notably) ConditionNode in the gateway
1 change: 1 addition & 0 deletions cspell.yaml
Expand Up @@ -19,6 +19,7 @@ dictionaries:
useGitignore: true
ignorePaths:
- '**/generated/**'
- 'packages/usage-reporting-protobuf/src/reports.proto'
- '**/*.sketch'
- '**/*.svg'
- cspell.yaml
Expand Down
Expand Up @@ -447,8 +447,6 @@ describe('sendHeaders makeHTTPRequestHeaders helper', () => {
function makeTestHTTP(): Trace.HTTP {
return new Trace.HTTP({
method: Trace.HTTP.Method.UNKNOWN,
host: null,
path: null,
});
}

Expand Down
9 changes: 0 additions & 9 deletions packages/server/src/plugin/usageReporting/plugin.ts
Expand Up @@ -425,15 +425,6 @@ export function ApolloServerPluginUsageReporting<TContext extends BaseContext>(
Trace.HTTP.Method[
http.method as keyof typeof Trace.HTTP.Method
] || Trace.HTTP.Method.UNKNOWN,
// Host and path are not used anywhere on the backend, so let's not bother
// trying to parse request.url to get them, which is a potential
// source of bugs because integrations have different behavior here.
// On Node's HTTP module, request.url only includes the path
// (see https://nodejs.org/api/http.html#http_message_url)
// The same is true on Lambda (where we pass event.path)
// But on environments like Cloudflare we do get a complete URL.
host: null,
path: null,
});

if (options.sendHeaders) {
Expand Down
6 changes: 6 additions & 0 deletions packages/server/src/plugin/usageReporting/stats.ts
Expand Up @@ -35,6 +35,12 @@ export class SizeEstimator {
bytes = 0;
}
export class OurReport implements Required<IReport> {
// Apollo Server includes each operation either as aggregated stats or as a
// trace, but not both. Other reporting agents such as Apollo Router include
// all operations in stats (even those that are sent as traces), and they set
// this flag to true.
tracesPreAggregated = false;

constructor(readonly header: ReportHeader) {}
readonly tracesPerQuery: Record<string, OurTracesAndStats> =
Object.create(null);
Expand Down
1,525 changes: 1,294 additions & 231 deletions packages/usage-reporting-protobuf/generated/protobuf.cjs

Large diffs are not rendered by default.

0 comments on commit 021460e

Please sign in to comment.