-
Notifications
You must be signed in to change notification settings - Fork 29
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 logging guidelines #182
Conversation
This looks reasonable. Can we give a crisp name to each log level? That would let us make some enums that we can expect to be used as the log level params. It'll give us semantics within the code that makes readability, and following this style decision a tad easier. |
I added the definitions from the k8s logging guidelines. They didn't define "crisp names" but I find it pretty helpful to follow. Pls suggest names if you have better ideas. Thanks! |
I wonder if we do this anywhere else in K8s but we could do something like: const(
REQUIRED=0
DEFAULT=1
VERBOSE_DEFAULT=2
DETAILED=3
DEBUG=5
TRACE=5
) Names are a quick attempt and probably suck. But this would make reasoning about what log level to use a little easier and keeps someone from having to constantly refer to our dev guide in the middle of development. |
I like it. I think it covers most cases, and people can refer to the dev guide for more nuanced cases if unsure. Will wait to see if others have any suggestions, otherwise I will update the 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.
A few non-blocking nits.
/lgtm
✅ Deploy Preview for gateway-api-inference-extension ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@danehans I am skipping this for now. Also I think we can better address point 2 by creating a logger wrapper in common places to include those context. @kfswain I slightly changed the logging level constant names you suggested. PTAL! |
|
||
4. Metric scraping loops. These loops run at a very high frequency, and logs can be very spammy if not handled properly. | ||
* `klog.V(DEBUG).InfoS` | ||
* Transient errors/warnings, such as failure to get response from a pod. |
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.
This should be logged as error so that it shows up clearly in the logs for the platform admin
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.
This loop runs very frequently (current default is 20ms). Even some transient error will create a spam. So I am suggesting using DEBUG for any logging here.
I think to solve the error visibility problem, we can have that in the debug loop under the "Misc" section below, which runs every 5s. Wdyt?
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.
ok, we can discuss on the specific implementation PRs.
Small comment, but otherwise LGTM! Thanks for doing this, I'll put a hold as well so others can still make a pass, fix small nits, what have you. But feel free to pull the hold off at your leisure. /hold |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danehans, kfswain, liu-cong The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
/unhold |
This is the first attempt to define logging guidelines in our current code base. This is not meant to be perfect/permanent, but something that can improve our logging quickly.
I am happy to follow up with a PR to update logging once this is approved.
Related issue: #108
cc @danehans @ahg-g