Skip to content

Commit

Permalink
Merge pull request #132 from apollographql/chang/operation-registry/r…
Browse files Browse the repository at this point in the history
…eporting

Set `registeredOperation` and `forbiddenOperation` on `requestContext.metrics` - AP-478
  • Loading branch information
cheapsteak authored Jun 6, 2019
2 parents 5a79ddf + 6ebbf79 commit 126434a
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export default function plugin(options: Options = Object.create(null)) {
logger.debug(
`${logHash}: Permitting operation found in local registry.`,
);
requestContext.metrics.registeredOperation = true;
return;
}

Expand Down Expand Up @@ -209,6 +210,7 @@ export default function plugin(options: Options = Object.create(null)) {
dryRunPrefix} ${logHash}: Execution denied because 'forbidUnregisteredOperations' was enabled for this request and the operation was not found in the local operation registry.`,
);

requestContext.metrics.forbiddenOperation = true;
if (!options.dryRun) {
throw new ForbiddenError('Execution forbidden');
} else {
Expand Down

0 comments on commit 126434a

Please sign in to comment.