Skip to content

Conversation

@pohly
Copy link
Contributor

@pohly pohly commented Nov 17, 2025

The main purpose of error logging is informing admins about problems. Our logging libraries are not configured to log additional debug information for errors.

Producing an error log before returning an error is usually wrong.

runtime.HandleErrorWithContext and runtime.HandleErrorWithLogger were not mentioned even though they are meant to be used in some places.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 17, 2025
@k8s-ci-robot k8s-ci-robot added area/developer-guide Issues or PRs related to the developer guide size/S Denotes a PR that changes 10-29 lines, ignoring generated files. sig/contributor-experience Categorizes an issue or PR as relevant to SIG Contributor Experience. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. labels Nov 17, 2025
@pohly pohly force-pushed the error-logging branch 3 times, most recently from 5b58828 to d9ad77a Compare November 17, 2025 17:24
The main purpose of error logging is informing admins about problems.
Our logging libraries are not configured to log additional debug information
for errors.

Producing an error log before returning an error is usually wrong.

runtime.HandleErrorWithContext and runtime.HandleErrorWithLogger were not
mentioned even though they are meant to be used in certain places.
@pohly
Copy link
Contributor Author

pohly commented Nov 17, 2025

/assign @deads2k

Comment on lines +79 to +81
Whenever possible, use this instead of normal error logging at the top of a call chain, i.e. the place where code
cannot return an error up to its caller, if there is no other way of handling the error (like logging it
and then exiting the process).
Copy link
Contributor

Choose a reason for hiding this comment

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

Great advice, thanks.

lgtm. I'll leave it open for others to comment, but if it's still open in a week or two remind me and I'll tag for merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's been a week and @dashpole also approves of it.

@dashpole, @deads2k, can one of your LGTM?

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dashpole, pohly

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/developer-guide Issues or PRs related to the developer guide cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. sig/contributor-experience Categorizes an issue or PR as relevant to SIG Contributor Experience. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants