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

Fix error reporting #8250

Merged
merged 1 commit into from
Sep 22, 2023
Merged

Fix error reporting #8250

merged 1 commit into from
Sep 22, 2023

Conversation

manuelbuil
Copy link
Contributor

@manuelbuil manuelbuil commented Aug 28, 2023

Proposed Changes

Use logrus to report the error instead of fmt to avoid an rke2 windows bug.

This fixes: rancher/rke2#4693

To report stuff on Windows Event Logger, we are using a logrus hook, i.e. any log created by logrus, gets printed in the Event Tracing for Windows (EWT) (some sort of journalctl). However, anything else is dropped, e.g. fmt messages.

https://github.com/rancher/wins/blob/main/pkg/logs/etw.go#L125-L132

Types of Changes

Bugfix

Verification

Try breaking something in containerd/k3s and check that it gets reported correctly in journalctl

Testing

The bug is in rke2

Linked Issues

rancher/rke2#4693
#8251

User-Facing Change


Further Comments

@codecov
Copy link

codecov bot commented Aug 28, 2023

Codecov Report

Patch coverage has no change and project coverage change: +4.12% 🎉

Comparison is base (2cb7023) 47.45% compared to head (d3f7632) 51.58%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8250      +/-   ##
==========================================
+ Coverage   47.45%   51.58%   +4.12%     
==========================================
  Files         143      143              
  Lines       14724    14732       +8     
==========================================
+ Hits         6988     7599     +611     
+ Misses       6631     5931     -700     
- Partials     1105     1202      +97     
Flag Coverage Δ
e2etests 48.86% <0.00%> (?)
inttests 44.70% <0.00%> (-0.09%) ⬇️
unittests 19.83% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
pkg/agent/containerd/containerd.go 20.39% <0.00%> (ø)

... and 44 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -93,7 +93,7 @@ func Run(ctx context.Context, cfg *config.Node) error {

addDeathSig(cmd)
if err := cmd.Run(); err != nil {
fmt.Fprintf(os.Stderr, "containerd: %s\n", err)
logrus.Errorf("containerd failed: %s", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: in other places we say "exited" when things exit unexpectedly

Suggested change
logrus.Errorf("containerd failed: %s", err)
logrus.Errorf("containerd exited: %s", err)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks! Done

Signed-off-by: Manuel Buil <mbuil@suse.com>
@manuelbuil
Copy link
Contributor Author

Code freeze period. No merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when executing containerd in Windows is not logged
3 participants