Skip to content

Commit

Permalink
reporting: fix forbidden/unregistered op reporting (#2828)
Browse files Browse the repository at this point in the history
* reporting: fix forbidden/unregistered op reporting

* update changelog
  • Loading branch information
Evans Hauser committed Jun 11, 2019
1 parent c8c99e4 commit aefe8ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,8 @@

### vNext

- `apollo-engine-reporting`: Set `forbiddenOperation` and `registeredOperation` later in the request lifecycle [PR #2828](https://github.com/apollographql/apollo-server/pull/2828)

### v2.6.2

- `apollo-engine-reporting-protobuf`: Update protobuff to include `forbiddenOperations` and `registeredOperations` [PR #2768](https://github.com/apollographql/apollo-server/pull/2768)
Expand Down
10 changes: 4 additions & 6 deletions packages/apollo-engine-reporting/src/extension.ts
Expand Up @@ -138,12 +138,6 @@ export class EngineReportingExtension<TContext = any>
if (o.requestContext.metrics.persistedQueryRegister) {
this.trace.persistedQueryRegister = true;
}
if (o.requestContext.metrics.forbiddenOperation) {
this.trace.forbiddenOperation = true;
}
if (o.requestContext.metrics.registeredOperation) {
this.trace.registeredOperation = true;
}
}

if (this.options.privateVariables !== true && o.variables) {
Expand Down Expand Up @@ -204,6 +198,10 @@ export class EngineReportingExtension<TContext = any>

this.trace.fullQueryCacheHit = !!o.requestContext.metrics
.responseCacheHit;
this.trace.forbiddenOperation = !!o.requestContext.metrics
.forbiddenOperation;
this.trace.registeredOperation = !!o.requestContext.metrics
.registeredOperation;

// If the `operationName` was not already set elsewhere, for example,
// through the `executionDidStart` or the `willResolveField` hooks, then
Expand Down

0 comments on commit aefe8ea

Please sign in to comment.