Replies: 3 comments 1 reply
-
Thank you @abkfenris for the amazing solution, works great. I was wondering if you figured out a way to avoid having to add For example I tried using capture_op_exception as a simple function wrapper instead of a decorator. This would allow us to wrap all assets with capture_op_exception before inserting them to the Definitions object. So we could do:
Unfortunately we get an error related to type checking:
Looking at the code for @capture_op_exception is also sensitive to where you insert it. You have to insert it after It would be great to have an official Sentry integration given Sentry's popularity. Thanks again for the code! |
Beta Was this translation helpful? Give feedback.
-
Want to bump this because this is something we would love to see. Our plan is to fork Dagster and submit a PR to integrate this, but we do not have rich understanding of how the system works currently. The investigation on this page though is priceless thank you for posting. Would be great to do something like
So that any number of these handlers can be added. The exception would get broadcast to all subscribed handlers, including the build-in one. The caveat is that exceptions are heavy and in this case we don't want to handle them (in a blocking manner) as much as we just want to get notified of them and get them as data to pass it on elsewhere. So perhaps Anyway, we've been huge fans of Dagster and have a lot of our workloads ported over to it, but atm we essentially need to manually visit the UI periodically to check in on failures. We'll embark on trying to do this ourselves unless the Dagster team has a better design idea or a quicker way to tackle. |
Beta Was this translation helpful? Give feedback.
-
+1 - If the dagster team can help enable this, it would be a huge help to our organization. We'd love to have full exception tracking/tracing via sentry. |
Beta Was this translation helpful? Give feedback.
-
While Dagster's logging is really nice, it doesn't always give you quite as much information right when an exception happens as some other tools. Personally I use Sentry.io to capture exceptions in other things I build, so I tried to get it integrated into Dagster jobs.
The main way that data gets sent to Sentry is by attaching to
sys.excepthook
. Dagster however wraps all user functions with a broad exception handler, so exceptions never make it up to the system level. Sentry however will pick up that something bad has happened via log messages, but it won't have any of the context that usually makes it so useful.It turns out that two can play the game of intercepting exceptions, so here's how I've gotten Sentry and Dagster to play nice.
First I made a helper to set up the Sentry client without a few of the usual integrations, and get it to ignore the
dagster
logger.Then I created my own decorator to sit in between
dagster.op
send exceptions to Sentry before letting Dagster at them.It also emits the unique Sentry event ID into the Dagster logs to help in finding the error.
Then it's used as a decorator on the ops.
Dagster now lets us know that a Sentry error has been made.
And Sentry has all sorts of context of what went wrong.
There are probably other ways that Sentry could be closer integrated (such as using
dagster.logger
with the various Sentry logging handlers), but now between Sentry and Dagster I have enough context to deal with many more errors without having to log every variable along the way.Beta Was this translation helpful? Give feedback.
All reactions