-
Notifications
You must be signed in to change notification settings - Fork 669
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 Support For Structured Logging #347
Comments
@farah would you be interested in working on this? |
Of course, thanks sean. /assign |
@farah thanks for your help with this. Let us know if you have any questions. FYI @damemi and @ingvagabund I'm proposing adding structured logging support to descheduler. Please let me know if you have any concerns. Thanks! |
Looks good. It will force us to write better log messages :) Also, opens a possibility to parse the logs properly and allows to build various models from the logs which can be used to see how descheduler behaves. Can you still use |
+1 for improving logging! |
@farah thanks for helping to get the initial structured logging changes completed in #376. Do you want to submit a PR to add the Also, I think there are still some log messages that need to be converted to use structured logging( We would like to complete the conversion to structured logging as part of the descheduler v0.20.0(k8s v1.20.0) release cycle. Let me know if you need any help with this effort. See below for examples of log statements that still need to be converted to use
|
Hey Sean, sure no problem. I'll get to them soon. I was actually about to create a new issue for tracking the logging format flag, but I guess we could do it here. |
@farah feel free to break this up into multiple smaller pull requests. You don't need to do all of the changes in a single PR. Thanks! |
@seanmalloy Just to be clear, are you suggesting that all logs be structured? FWIW in the KEP it says migrating all logs to be structured is a non-goal. The ones you posted I left out deliberately because I surmised that it didn't make sense to structure it. Having had another look I can see a few more that could in fact be structured, like these:
What about logs like these?
Basically I'm asking for some kind of criteria to decide whether a log should be structured as I'm not 100% on some of them (like abive) |
i think I'm overcomplicating it, most could be structured. I will do them all and you can you review them. |
@seanmalloy I put a PR to convert the remaining ones. I left this one out:
|
There are still some small changes required before this is 100% done. /reopen |
@seanmalloy: Reopened this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@farah it looks like we are very close to being 100% converted to structured logging. Would you be willing to convert these last few log statements? Log statements that need to be converted to use
Log statements that need to be converted to use
|
Some logs, like klog.Errorf("invalid nodeAffinityType: %v", nodeAffinity) can't be converted as klog.ErrorS requires an error as the first argument. |
@farah it can be acceptable to use |
@farah we are in the home stretch. Would you be able to finish these off and submit a PR to clean up these last few references? Just two references to
A small number of references to
|
This needs to say as it is since |
Ok guys, I've just added PR for those final conversions. Lets keep this issue open as there's still the json log format flag remaining. |
I found one more log message that needed to be updated to use structured logging. I submitted #411 to clean this up. @farah I believe all that is left is to add the new |
Is your feature request related to a problem? Please describe.
As a user of descheduler I'd like the descheduler to support generating structured logs, so that my log aggregation tools can more easily parse the descheduler logs. The k/k repo has recently started adding support for structured logs.
Describe the solution you'd like
Add a new
--logging-format
CLI option to descheduler to allow choosing between text and json log formats. The text log format should be the default.Update klog usage in descheduler to use the new
InfoS
andErrorS
methods, https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/1602-structured-logging#new-klog-methods.Describe alternatives you've considered
Using the descheduler logs as is without any changes.
What version of descheduler are you using?
descheduler version: v0.18.0
Additional context
See structured logging KEP: https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/1602-structured-logging.
PR to add the
--logging-format
option to kube-scheduler: kubernetes/kubernetes#91522.The text was updated successfully, but these errors were encountered: