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

Logs previous exception if present #1097

Merged
merged 2 commits into from
Mar 17, 2025
Merged

Logs previous exception if present #1097

merged 2 commits into from
Mar 17, 2025

Conversation

ArneTR
Copy link
Member

@ArneTR ArneTR commented Mar 16, 2025

Previous exception messages are now also listed. Before it was easily masked what the true cause of the error was.

It could happen, that the container did not boot correctly and then the metrics could not be read also. However as error only the fail in reading the metrics was reported.

This is now changed from:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 0_o >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Error: RuntimeError occured in runner.py

Exception (RuntimeError): PowermetricsProvider returned error message: Metrics provider powermetrics seems to have not produced any measurements. Metrics log file was empty. Either consider having a higher sample rate or turn off provider.
...

To:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 0_o >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Error: RuntimeError occured in runner.py

Exception (RuntimeError): PowermetricsProvider returned error message: Metrics provider powermetrics seems to have not produced any measurements. Metrics log file was empty. Either consider having a higher sample rate or turn off provider.
Initial_exceptions (OSError): Docker run failed
Stderr: docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "sleep asd": executable file not found in $PATH: unknown.

Greptile Summary

Enhanced error logging across the application by including previous exception information, improving the ability to diagnose root causes of cascading failures, particularly for container boot and metric reading issues.

  • Added previous_exception=exc.__context__ parameter in error logging calls throughout /cron/client.py
  • Modified error handling blocks to capture complete exception chain instead of just final error
  • Improved error messages now show full error trace from initial container failure to subsequent metric reading errors
  • Consistent error handling approach with /api/main.py and /runner.py changes

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

@ArneTR ArneTR merged commit dbd36a0 into main Mar 17, 2025
2 checks passed
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.

1 participant