Hi All, Thanks for the great resources. I'm very n...
# dev-metaflow
f
Hi All, Thanks for the great resources. I'm very new to metaflow and have been tasked with getting exceptions into Sentry from our flows for alerting and debugging. I've played with using the currently documented method of adding the
@catch
decorator and handling exceptions in the next step. This pickles the stacktrace as a string so I'm limited to sending all exceptions as MetaflowExceptionWrapper to sentry with the original stacktrace as a string. This isn't ideal for grouping exceptions in Sentry to be able to keep track of any new exceptions. We were thinking about adding the ability to pass a function into
@catch
decorator ie.
exception_logger
that is called with the original exception prior to it being pickled. I'd welcome any feedback on other ways of handling this problem at a high level or if this is a good idea and potential for a PR back to metaflow? TIA Louis
1
s
hmm, I am not intimately familiar with Sentry but if I understand correctly, it wants the original exception object, not just a string representation of its type and stacktrace?
👍 1
one option is to create a custom
@sentry_logger
decorator like this:
🤓 2
here you would replace
log_to_sentry
with an actual API call sending the exception
x
to Sentry
the only difference to
@catch
is that this won't handle hard crashes, e.g. out-of-memory conditions or segfaults, but you wouldn't get a Python exception in those cases anyways
f
@straight-shampoo-11124 thanks so much! That is exactly what I was hoping to achieve. I am about to order your book. Looking forward to a hard copy one day!
yayfox 1