Skip to content

Capture view creation errors with Sentry capture_exception - #341

Open
MaxAlex wants to merge 3 commits into
mainfrom
capture_view_creation_errors_in_sentry
Open

MaxAlex wants to merge 3 commits into
mainfrom
capture_view_creation_errors_in_sentry

Conversation

@MaxAlex

@MaxAlex MaxAlex commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

The S3 view query errors we saw earlier did not appear in Sentry, which was due to the way we have Sentry integrataion configured; events only appear in Sentry if explicitly captured by capture_exception(), which is invoked in OdinJob when it sees an exception. View creation errors are caught, so that a single exception doesn't stop the entire catalog creation process; this adds capture_exception() to those clauses so that Sentry will be aware of view errors.

@MaxAlex
MaxAlex requested a review from a team as a code owner November 6, 2026 20:24
@MaxAlex
MaxAlex requested review from runkelcorey and removed request for a team November 6, 2026 20:24

@runkelcorey runkelcorey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not put sentry_sdk.capture_exception into the logger's .failed() method so that all errors are forwarded if caught?

@MaxAlex

MaxAlex commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Why not put sentry_sdk.capture_exception into the logger's .failed() method so that all errors are forwarded if caught?

I remember looking at this approach when I was originally putting the Sentry integration in, and deciding not to do it that way, but I can't find any notes on why. It's worth a shot.

Comment thread src/odin/utils/logger.py
Comment on lines 158 to 164
for tb in traceback.format_tb(exception.__traceback__):
for line in tb.strip("\n").split("\n"):
LOGGER.error(f"uuid={self.uuid}, {line.strip('\n')}")

# Log Exception
for line in traceback.format_exception_only(exception):
LOGGER.error(f"uuid={self.uuid}, {line.strip('\n')}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I know this isn't the focus of your change, but is this logging the same error twice?

@runkelcorey

Copy link
Copy Markdown
Contributor

@MaxAlex please fix CI first

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.

2 participants