-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ROUTER-890] Ability to skip safelisting enforcement via plugin
If safelisting is enabled, a `router_service` plugin can skip enforcement of the safelist (including the `require_id` check) by adding the key `apollo_persisted_queries::safelist::skip_enforcement` with value `true` to the request context. (This does not affect the logging of unknown operations by the `persisted_queries.log_unknown` option.) In cases where an operation would have been denied but is allowed due to the context key existing, the attribute `persisted_queries.safelist.enforcement_skipped` is set on the `apollo.router.operations.persisted_queries` metric with value true. This PR improves the testing of that metric as well. When writing the tests, I discovered that the `persisted_queries.safelist.rejected.unknown` attribute had its value set to `false` when the operation is denied but not logged, and to `true` when denied and logged. (You can also tell whether it is logged via the `persisted_queries.logged` attribute.) This dated to the creation of this metric in #3609 and seems to be a mistake. This PR normalizes this attribute to always be `true` if it is set. The metric was described as unstable when released in v1.28.1, so this seems reasonable.
- Loading branch information
Showing
9 changed files
with
346 additions
and
160 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
.changesets/breaking_glasser_pq_metric_attribute_consistency.md
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,9 @@ | ||
### More consistent attributes on `apollo.router.operations.persisted_queries` metric ([PR #6403](https://github.com/apollographql/router/pull/6403)) | ||
|
||
Version 1.28.1 added several *unstable* metrics, including `apollo.router.operations.persisted_queries`. | ||
|
||
When an operation is rejected, Router includes a `persisted_queries.safelist.rejected.unknown` attribute on the metric. Previously, this attribute had the value `true` if the operation is logged (via `log_unknown`), and `false` if the operation is not logged. (The attribute is not included at all if the operation is not rejected.) This appears to have been a mistake, as you can also tell whether it is logged via the `persisted_queries.logged` attribute. | ||
|
||
Router now only sets this attribute to true, and never to false. This may be a breaking change for your use of metrics; note that these metrics should be treated as unstable and may change in the future. | ||
|
||
By [@glasser](https://github.com/glasser) in https://github.com/apollographql/router/pull/6403 |
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,10 @@ | ||
### Ability to skip Persisted Query List safelisting enforcement via plugin ([PR #6403](https://github.com/apollographql/router/pull/6403)) | ||
|
||
If safelisting is enabled, a `router_service` plugin can skip enforcement of the safelist (including the `require_id` check) by adding the key `apollo_persisted_queries::safelist::skip_enforcement` with value `true` to the request context. | ||
|
||
(This does not affect the logging of unknown operations by the `persisted_queries.log_unknown` option.) | ||
|
||
In cases where an operation would have been denied but is allowed due to the context key existing, the attribute | ||
`persisted_queries.safelist.enforcement_skipped` is set on the `apollo.router.operations.persisted_queries` metric with value true. | ||
|
||
By [@glasser](https://github.com/glasser) in https://github.com/apollographql/router/pull/6403 |
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.