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

For sharedmain zap's Fatal should deterministically calculate the POSIX return code #2495

Closed
cardil opened this issue Apr 22, 2022 · 2 comments
Labels
area/test-and-release kind/feature lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@cardil
Copy link
Contributor

cardil commented Apr 22, 2022

/area test-and-release
/kind feature

Actual Behavior

The Zap's Fatal method is calling os.Exit(1) regardless of a message. This isn't the best UX choice. The POSIX return code could be used for quick assessment about a process failure. When the retcode is always equal 1 for any error, this can't be utilized.

Tools like Docker or Kubernetes report back the return code of the process. By using a deterministic algorithm to calculate the POSIX return code, a quick debugging is possible. Users could indicate if the process is failing because of the same reason, without looking into logs.

Expected Behavior

The best would be to rely on Fatal's message or on an error object if it's attached as a Field.

Additional Info

Related to uber-go/zap#1086

@github-actions
Copy link
Contributor

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 22, 2022
@dprotaso
Copy link
Member

Going to close this out - see the comments on the PR. I think this will be confusing for users as certain exit codes have specific meanings.

I think the better approach would be to ensure we write to the k8s termination path

see: https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/test-and-release kind/feature lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants