-
Notifications
You must be signed in to change notification settings - Fork 619
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
Structured logging for docker image manager #3696
Conversation
e4f87a5
to
70df265
Compare
70df265
to
b64e8bd
Compare
@@ -272,7 +273,7 @@ func (imageManager *dockerImageManager) removeImageState(imageStateToBeRemoved * | |||
for i, imageState := range imageManager.imageStates { | |||
if imageState.Image.ImageID == imageStateToBeRemoved.Image.ImageID { | |||
// Image State found; hence remove it | |||
seelog.Infof("Removing Image State: [%s] from Image Manager", imageState.String()) | |||
logger.Debug("Image Manager: removing image state", imageState.Fields()) |
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 is not removing the image state from the instance, only from the agent's internal tracking object. This seems confusing to have as a public INFO message so making it debug
// no image states present in image manager | ||
return nil | ||
} | ||
var imagesForDeletion []*image.ImageState | ||
for _, imageState := range imageManager.imageStatesConsideredForDeletion { | ||
if imageManager.isImageOldEnough(imageState) && imageState.HasNoAssociatedContainers() { | ||
seelog.Infof("Candidate image for deletion: [%s]", imageState.String()) | ||
logger.Debug("Candidate image for deletion", imageState.Fields()) |
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.
these messages are logged multiple times when the image is actually removed, and then again on each "removal" loop, so making it debug
55bdb5f
to
b64e8bd
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.
Thanks!
* Structured logging for docker image manager * Add some reused fields to logger/field/constants.go * Add missing 'imageTag' field from err message
* Structured logging for docker image manager * Add some reused fields to logger/field/constants.go * Add missing 'imageTag' field from err message
* Structured logging for docker image manager * Add some reused fields to logger/field/constants.go * Add missing 'imageTag' field from err message
Summary
Make the docker image manager logs more readable and traceable by using structured logging and adding fields with consistent metadata about the image in each log line.
Also moved a few redundant log messages from INFO to DEBUG
Description for the changelog
NA
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.