-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
log: add option to deactivate zap stack trace generation #2319
log: add option to deactivate zap stack trace generation #2319
Conversation
605362f
to
1107042
Compare
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.
Instead of adding a new flag, it may be more convenient to add a --zap-level=disabled
.
Con: it doesn't exactly align with zap log levels
Pro: it adds the desired functionality without cluttering the CLI
IMO it is ok to have CLI decoupled from configuration. @joelanford @hasbro17 @jmrodri thoughts?
@vboulineau also make sure to run $ make gen-cli-doc before pushing so docs are generated correctly. |
@estroz @vboulineau We've recently been contributing to the upstream controller-runtime One of the options currently exposed there is the stacktrace level. Based on that, I'm curious if you think a If we go this direction, it aligns well with the upstream zap logging package, it provides more fine-grained stacktrace configuration, and it (I think) still meets your use case of cleaning up the logs by allowing you to set it to a level such that it that will only show up in catastrophic situations. What do you think? |
@joelanford I guess it makes sense to log stack trace on panic, as it's likely to be an unexpected behaviour, I can rework the PR to add this flag instead! Update: PR updated with a stacktrace level. Unfortunately I had to create another 'level' type to avoid cases of stackLevel being < logLevel and to have proper default value in the doc generation (error), I recognised it's not super clean but I was not able to find something better (feel free if you have a better idea). |
1107042
to
4f203fc
Compare
ac98356
to
dad7f53
Compare
dad7f53
to
54173b4
Compare
Hi @vboulineau, See that these changes are not passing in the lint check:
To check it locally, specifically, run |
54173b4
to
a21e0bd
Compare
Updated, thanks for picking that up! |
a21e0bd
to
1cc229f
Compare
Hey team, do you think this could be merged for 0.16? We were hoping to have it in 0.15 but it seems the release happened already. |
CHANGELOG.md
Outdated
@@ -4,6 +4,7 @@ | |||
|
|||
- Added new `--bundle` flag to the `operator-sdk scorecard` command to support bundle validation testing using the validation API (https://github.com/operator-framework/api). ([#1916](https://github.com/operator-framework/operator-sdk/pull/1916) | |||
- Added new `log` field to the `operator-sdk scorecard` v1alpha2 output to support tests that produce logging. ([#1916](https://github.com/operator-framework/operator-sdk/pull/1916) | |||
- Add a new option to set the minimum loglevel that triggers stack trace generation in logs (`--zap-stacktrace-level`) ([#2319](https://github.com/operator-framework/operator-sdk/pull/2319)) |
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.
- Add a new option to set the minimum loglevel that triggers stack trace generation in logs (`--zap-stacktrace-level`) ([#2319](https://github.com/operator-framework/operator-sdk/pull/2319)) | |
- Add a new option to set the minimum log level that triggers stack trace generation in logs (`--zap-stacktrace-level`) ([#2319](https://github.com/operator-framework/operator-sdk/pull/2319)) |
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.
Fixed, thank you
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.
@vboulineau Can you fix the merge conflicts? I think it requires re-running make gen-cli-doc
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.
@vboulineau SGTM other than rebasing and the typo in the CHANGELOG.
1cc229f
to
4d55500
Compare
For some of our public operators, we would like to keep logs clean and tidy to improve readability/investigations for our customers
4d55500
to
c069503
Compare
Thanks for the reviews, rebased and fix CHANGELOG, should be good to go. |
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.
LGTM
@vboulineau Thanks for working on this. We should be able to get this in the next release now.
Add an option to deactivate stack trace generation, similar to an existing option in Zap itself.
https://github.com/uber-go/zap/blob/v1.10.0/config.go#L202
For some of our public operators, we would like to keep logs clean and tidy to improve readability/investigations for our customers