-
Notifications
You must be signed in to change notification settings - Fork 69
Use contextual logging #337
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
Conversation
Hi @tchap. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
9712144
to
4c6d700
Compare
✅ Deploy Preview for gateway-api-inference-extension ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for gateway-api-inference-extension ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
targetModelName: "t20", | ||
receivedTime: timeBaseline, | ||
completeTime: timeBaseline.Add(time.Millisecond * 120), | ||
}{ |
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.
Formatting improved as a side effect, ignore.
if err := p.refreshMetricsOnce(); err != nil { | ||
klog.V(logutil.TRACE).ErrorS(err, "Failed to refresh metrics") | ||
if err := p.refreshMetricsOnce(logger); err != nil { | ||
logger.V(logutil.DEFAULT).Error(err, "Failed to refresh metrics") |
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 actually changed this to DEFAULT
as I feel logging errors on TRACE
is weird, but unsure.
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 can just get very spammy if the errors are transient, but I suppose it's a fair point that you want to be aware of the error regardless.
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 have a few comments that don't block this PR and we can address as followup since it is huge. But overall I am onboard with this. will let @kfswain make the final pass and lgtm when ready.
This overall lgtm, I do agree with the context as the param so long as the logger lookup is not expensive. However I'm familiarizing myself with https://github.com/go-logr/logr/tree/v1.4.2 before I LGTM. Will follow up shortly |
Read through the blog post linked in: https://github.com/go-logr/logr/tree/v1.4.2?tab=readme-ov-file#inspiration As well as where /lgtm I think the context comments can be handled in a following PR, just holding to give time for an Ack. Thanks for all the help! |
Aligned the log levels and passing a ctx around instead of a logger, so all review issues should be fixed now. Seems I also still need ok-to-test... |
df7a7ae
to
dc4c922
Compare
/unhold |
/ok-to-test |
dc4c922
to
2320fe5
Compare
All possible direct klog calls are removed. Instead logr.Logger is loaded from the context or passed around as an argument.
2320fe5
to
04b2967
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.
Sorry, a couple more nits
Co-authored-by: Abdullah Gharaibeh <[email protected]>
/lgtm This is awesome, great work! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahg-g, tchap 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 |
All possible direct klog calls are removed.
Instead logr.Logger is loaded from the context
or passed around as an argument.
Related to #251 , this basically concludes the issue.
Testing
Regarding testing, this is pretty hard to test. I am not really able to run integration tests and failing to call
ctrl.SetLogger
and loading a logger from the context would result, I guess, in log entries being dropped. I don't think this can really happen asctrl.SetLogger
is being called for sure, but it does seem a bit fragile.