-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
log: debug manifest cache #9602
log: debug manifest cache #9602
Conversation
Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> fix silly refactor Signed-off-by: Michael Crenshaw <michael@crenshaw.dev>
Codecov Report
@@ Coverage Diff @@
## master #9602 +/- ##
==========================================
- Coverage 45.82% 45.78% -0.04%
==========================================
Files 222 226 +4
Lines 26376 26713 +337
==========================================
+ Hits 12087 12231 +144
- Misses 12642 12818 +176
- Partials 1647 1664 +17
Continue to review full report at Codecov.
|
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.
Function signatures are already huge and we can avoid adding additional parameters to them if we log in the caller function.
Signed-off-by: Michael Crenshaw <michael@crenshaw.dev>
Signed-off-by: Michael Crenshaw <michael@crenshaw.dev>
// LogDebugManifestCacheKeyFields logs all the information included in a manifest cache key. It's intended to be run | ||
// before every manifest cache operation to help debug cache misses. | ||
func LogDebugManifestCacheKeyFields(message string, reason string, revision string, appSrc *appv1.ApplicationSource, clusterInfo ClusterRuntimeInfo, namespace string, trackingMethod string, appLabelKey string, appName string) { | ||
if log.IsLevelEnabled(log.DebugLevel) { |
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 don't think this check is required.
Logrus already checks for this inside the Debug
function:
https://github.com/sirupsen/logrus/blob/v1.8.1/logger.go#L195-L201
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.
It's just a small performance enhancement. Calculating the fields involves some JSON marshaling that I'd rather avoid unless we know we're going to log.
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
Some more logging. It was critical to debugging #9601, and I think it might be useful in the future.