-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add a flag to disable authorization error logs #4076
Conversation
Authorization errors can be seen as common usage of the service when filtering fields from queries depending on the client's rights, so they might not warrant error logs to be analyzed by the router operators
CI performance tests
|
pub(crate) fn log_errors(configuration: &Configuration) -> bool { | ||
let has_config = configuration | ||
.apollo_plugins | ||
.plugins | ||
.iter() | ||
.find(|(s, _)| s.as_str() == "authorization") | ||
.and_then(|(_, v)| v.get("preview_directives").and_then(|v| v.as_object())) | ||
.and_then(|v| v.get("log_errors").and_then(|v| v.as_bool())); | ||
has_config.unwrap_or(true) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that looks useless but could you write a small test to check that function ? Basically it's to prevent breaking change when we will remove preview_
prefix and if we decide to change the configuration shape later
```yaml | ||
authorization: | ||
preview_directives: | ||
log_errors: true | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have strong feelings about this, but ould this be better as:
authorization:
preview_directives:
logging:
enabled: true
?
We seem to be settling on this enabled
true|false
style and I wonder if it's just about enabling logging
for directives or specifically errors
.
also: We should specify if enabled or not by default here and in the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @BrynCooke as you might have a preference in light of the telemetry recent work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends if we see further logging configuration in the future.
If we think there will be more config:
authorization:
preview_directives:
log:
errors: true
We can always tackle this with a migration though, so happy with for now:
authorization:
preview_directives:
log_errors: true
Co-authored-by: Bryn Cooke <[email protected]>
Fix #4077
Authorization errors can be seen as common usage of the service when filtering fields from queries depending on the client's rights, so they might not warrant error logs to be analyzed by the router operators
Checklist
Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.
Exceptions
Note any exceptions here
Notes
Footnotes
It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this. ↩
Configuration is an important part of many changes. Where applicable please try to document configuration examples. ↩
Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions. ↩