Review registration log traces for Provisioner#757
Review registration log traces for Provisioner#757metal3-io-bot merged 1 commit intometal3-io:masterfrom
Conversation
|
How easy/hard is it to change the verbosity level of the log output to debug a problem? I've usually found that it's better to log a little more, and throw info away in the log aggregation tool, but there's not a hard rule about where that line is. |
zaneb
left a comment
There was a problem hiding this comment.
What does logging at verbosity level 5 mean in practice?
I see we have a -dev flag to "enable developer logging", but no way to set the verbosity level explicitly AFAICT.
|
|
||
| info.host.ClearError() | ||
| // Avoid to clean up other kind of errors | ||
| if info.host.Status.ErrorType == metal3v1alpha1.RegistrationError { |
There was a problem hiding this comment.
We should probably also always clear the error if registeredNewCreds is true. WDYT?
There was a problem hiding this comment.
That's an interesting point. I assumed that the error was set only here during the registration. In case of credentials change the ValidateManagementAccess can fail in the update, but in such case the actions gets simply re-enqueued (409) or an actionError is returned, so it seems that such scenario the ClearError() shouldn't be required for the host.
There was a problem hiding this comment.
Credentials can change at any time. If someone changes the password on the server prior to changing it in the BMH, then I think it's possible to see another kind of error.
It seems reasonable that once we know the creds have changed (and the change worked), we discard any assumptions about what we thought might have been broken before.
There was a problem hiding this comment.
Ok, so if IIUC changing the creds could be considered a very "strong" kind of event that somehow resets the current situation (forcing anyhow implicitly a re-evaluation).
Zap offers a couple of configuration options (see also https://pkg.go.dev/go.uber.org/zap#ex-package--BasicConfiguration) but as @zaneb correctly pointed out the verbosity level wasn't directly available. My original intention was also to have a smaller footprint assuming an optimistic case |
Following the logr docs indication the idea was to have a more technical debug level. I can see if we can use that flag instead |
I checked the current configuration and By default zap is configured to trace level 0 only (Info). |
b74251b to
6ce9300
Compare
|
Changed the implementation to use the |
|
/test-integration |
6ce9300 to
d67d800
Compare
| switch err.(type) { | ||
| case nil: | ||
| p.log.Info("found existing node by ID") | ||
| p.log.V(1).Info("found existing node by ID") |
There was a problem hiding this comment.
Let's set this up as a debugLog member in the ironicProvisioner struct.
d67d800 to
084037f
Compare
|
/test-integration |
| return hb | ||
| } | ||
|
|
||
| func (hb *hostBuilder) SetStatusError(opStatus metal3v1alpha1.OperationalStatus, errType metal3v1alpha1.ErrorType, errMsg string, errCount int) *hostBuilder { |
There was a problem hiding this comment.
Nit, does this need to be exported?
084037f to
ef745ac
Compare
|
I ended up with a patch to fix up the logs in the controller in #761 (some other stuff was dependent on moving it all around, so this will reduce conflicts). Stephen has included the change to limit which errors get reset in #762. So maybe let's reduce the scope of this PR to just the provisioner and get it merged? |
ef745ac to
15d1330
Compare
15d1330 to
06584aa
Compare
|
/test-integration |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andfasano, zaneb The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/lgtm |
This PR introduce a debug logger for the provisioner, to avoid printing too many traces in the log during the steady cases.