Skip to content

[23.0 backport] api/s/r/swarm: log backend errors at Debug level#45016

Merged
neersighted merged 1 commit intomoby:23.0from
corhere:backport-23.0/fix-spammy-cluster-api-logs
Feb 16, 2023
Merged

[23.0 backport] api/s/r/swarm: log backend errors at Debug level#45016
neersighted merged 1 commit intomoby:23.0from
corhere:backport-23.0/fix-spammy-cluster-api-logs

Conversation

@corhere
Copy link
Copy Markdown
Contributor

@corhere corhere commented Feb 16, 2023

- What I did
The errors are already returned to the client in the API response, so logging them to the daemon log is redundant. Log the errors at level Debug so as not to pollute the end-users' daemon logs with noise.

Refactor the logs to use structured fields. Add the request context to the log entry so that logrus hooks could annotate the log entries with contextual information about the API request in the hypothetical future.

- How I did it
Grepped for all logrus calls in cluster_routes.go and hand-edited them all.

- How to verify it
Code review?

- Description for the changelog

  • Errors handling Swarm API requests are now logged to the daemon log at Debug level instead of Error. These errors will continue to be returned to the client in the API request responses.

- A picture of a cute animal (not mandatory but encouraged)

The errors are already returned to the client in the API response, so
logging them to the daemon log is redundant. Log the errors at level
Debug so as not to pollute the end-users' daemon logs with noise.

Refactor the logs to use structured fields. Add the request context to
the log entry so that logrus hooks could annotate the log entries with
contextual information about the API request in the hypothetical future.

Fixes moby#44997

Signed-off-by: Cory Snider <csnider@mirantis.com>
(cherry picked from commit a4e3c67)
Signed-off-by: Cory Snider <csnider@mirantis.com>
@corhere corhere added area/api API kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. impact/changelog area/swarm area/daemon Core Engine labels Feb 16, 2023
@corhere corhere added this to the 23.0.2 milestone Feb 16, 2023
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api API area/daemon Core Engine area/swarm impact/changelog kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. status/4-merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants