-
Notifications
You must be signed in to change notification settings - Fork 13
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
ROX-15242 - Reduce fleetshard and fleet-manager log noise #785
Conversation
Skipping CI for Draft Pull Request. |
14be5d2
to
22920c5
Compare
083b0cb
to
15e8fa3
Compare
@@ -104,6 +104,8 @@ func (r *CentralReconciler) Reconcile(ctx context.Context, remoteCentral private | |||
return nil, errors.Wrapf(err, "checking if central changed") | |||
} | |||
|
|||
glog.Infof("Start reconcile central %s/%s", remoteCentral.Metadata.Namespace, remoteCentral.Metadata.Name) | |||
|
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 think logging here will still result in many log messages, should be after line 113 to have effect.
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.
And one more thing here, is it ok to log remoteCentral.Metadata.Name
? It's customer data, and I remember that when I wanted to tag the DB instances with the name, we decided not to do it.
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.
Not sure about if we should remove the name, but adding the ID would be good since this is most important to filter for logs of a specific tenant.
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.
The namespace already contains the Id, but it would be better to replace Namespace
with Id
.
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.
Convinced. I'll create a follow-up PR to this to keep the changes small.
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.
Structured logging would be great now :)
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.
Follow up PR: #856
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 think logging here will still result in many log messages, should be after line 113 to have effect.
Looks like my initial comment was forgotten because of the subsequent namespace / ID discussion.
I'd still move this log to after line 113, so that we avoid logging "Starting reconcile..." for every tenant, every 5-10 seconds. WDYT?
fleetshard/pkg/runtime/runtime.go
Outdated
@@ -4,6 +4,7 @@ package runtime | |||
import ( | |||
"context" | |||
"fmt" | |||
"github.com/stackrox/acs-fleet-manager/pkg/logger" |
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.
please move to the section below
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.
+1, usually the formatter should fix that. Don't know why it doesn't.
fleetshard/pkg/runtime/runtime.go
Outdated
@@ -119,7 +122,8 @@ func (r *Runtime) Start() error { | |||
} | |||
|
|||
// Start for each Central its own reconciler which can be triggered by sending a central to the receive channel. | |||
glog.Infof("Received %d centrals", len(list.Items)) | |||
reconciledCentralCountCache = int32(len(list.Items)) | |||
logger.InfoChangedInt32(&reconciledCentralCountCache, "Received central count changed: received %d centrals") |
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 doesn't seem to work as expected, here are some logs from my local machine:
I0222 16:18:02.130817 1 runtime.go:126] Received central count changed: received %d centrals0
I0222 16:19:32.236458 1 runtime.go:126] Received central count changed: received %d centrals0
I0222 16:19:32.236553 1 reconciler.go:107] Start reconcile central rhacs-cfr40h6og40g01q0bb50/test-central-1
I0222 16:19:32.277767 1 reconciler.go:285] Creating central rhacs-cfr40h6og40g01q0bb50/test-central-1
I0222 16:19:32.298116 1 reconciler.go:289] Central rhacs-cfr40h6og40g01q0bb50/test-central-1 created
I0222 16:19:42.247972 1 runtime.go:126] Received central count changed: received %d centrals0
I0222 16:19:42.248036 1 reconciler.go:107] Start reconcile central rhacs-cfr40h6og40g01q0bb50/test-central-1
I0222 16:19:42.267968 1 reconciler.go:291] Update central rhacs-cfr40h6og40g01q0bb50/test-central-1
I0222 16:19:52.259769 1 runtime.go:126] Received central count changed: received %d centrals0
I0222 16:19:52.259844 1 reconciler.go:107] Start reconcile central rhacs-cfr40h6og40g01q0bb50/test-central-1
I0222 16:19:52.285547 1 reconciler.go:291] Update central rhacs-cfr40h6og40g01q0bb50/test-central-1
I0222 16:20:02.266983 1 runtime.go:126] Received central count changed: received %d centrals0
I0222 16:20:02.267147 1 reconciler.go:107] Start reconcile central rhacs-cfr40h6og40g01q0bb50/test-central-1
I0222 16:20:02.296243 1 reconciler.go:291] Update central rhacs-cfr40h6og40g01q0bb50/test-central-1
I0222 16:20:12.277558 1 runtime.go:126] Received central count changed: received %d centrals0
I0222 16:20:12.277622 1 reconciler.go:107] Start reconcile central rhacs-cfr40h6og40g01q0bb50/test-central-1
I0222 16:20:12.294873 1 reconciler.go:291] Update central rhacs-cfr40h6og40g01q0bb50/test-central-1
I0222 16:20:22.290589 1 runtime.go:126] Received central count changed: received %d centrals0
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
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.
Removing my request changes to not block this PR while on PTO.
Removing my review to not block this PR while on PTO.
/retest |
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: johannes94, SimonBaeumer 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 |
8eed701
to
d9860c0
Compare
New changes are detected. LGTM label has been removed. |
d9860c0
to
e9fdfb2
Compare
/retest |
e9fdfb2
to
2b18159
Compare
Description
Clean up logs. Added logger to only log if the given integer value had changed.
Checklist (Definition of Done)
Test manual
ROX-12345: ...
Test manual
TODO: Add manual testing efforts