Skip to content
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

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

Merged

Conversation

corhere
Copy link
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 kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. impact/changelog area/swarm area/daemon labels Feb 16, 2023
@corhere corhere added this to the 23.0.2 milestone Feb 16, 2023
Copy link
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 area/daemon 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.

None yet

3 participants