Repository navigation
fix(logging): Send structlog exceptions to Sentry as exception events - #301
Conversation
format_exc_info consumed exc_info before the record reached stdlib, so Sentry's LoggingIntegration saw no exception for `.error(..., exc_info=...)` and captured a plain message. Sentry also stringified the whole event dict as the message, which made titles unreadable and broke grouping. Keep the exception tuple through the processor chain and pass it to stdlib as `exc_info`, and make the event dict stringify as the event name.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #301 +/- ##
==========================================
+ Coverage 97.73% 97.75% +0.02%
==========================================
Files 114 114
Lines 5112 5176 +64
==========================================
+ Hits 4996 5060 +64
Misses 116 116 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Logger._log already turns exception instances and `True` into an exc_info tuple, so pass the original value through instead of reimplementing that.
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Focused logging fix: structlog exceptions now reach Sentry as true exception events titled by event name, while OTel still receives the rendered exception; covered by new unit tests.
Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Focused logging fix: structlog exceptions reach Sentry as true exception events titled by the event name, while OTel still receives the rendered exception; covered by new unit tests.
Turn on auto-fix | Re-trigger cubic
emyller
left a comment
There was a problem hiding this comment.
One non-blocking design question.
In this PR, we make sure the structured error logs reach Sentry with original exception tracebacks, and Sentry uses log event name to display as log message rather than the entire log dictionary.