Closed simonlindroosfyndiq closed 2 years ago
This is currently intended behavior, but we could probably implement a similar solution to #303
Thank you for you answer, we did not expect this to be the expected behaviour. For now we will remove the SanicIntegration
for our team to proceed.
Sanic integration adds request data to your events so you'll lose some product value from disabling it. I'd recommend using the before_send
hook to filter out CustomException
: https://docs.sentry.io/error-reporting/configuration/filtering/?platform=python#before-send
Instead of setting a fingerprint you'd return None
to drop the event.
I've come across this as well, and I'm a bit surprised that this is the intended behavior. The docs for the Sanic integration say:
All exceptions leading to an Internal Server Error are reported.
I took this to mean that all exceptions that result in a 500 visible to a user would be reported, but perhaps I misunderstood? We're using custom exception handlers to handle 4xx errors, that shouldn't be logged to Sentry (which I think is a fairly common pattern?), but this makes that difficult.
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog
or Status: In Progress
, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
Hello @simonlindroosfyndiq and @j-boivie ! Just a quick update: I think it would be good if we would have the behavior similar to the one described in https://github.com/getsentry/sentry-python/issues/303 like @untitaker suggested.
(so basically only send unhandled exceptions to Sentry)
So, anyone of you (or anyone else from the Sanic community) is motivated and also has the time to provide a PR for this? (In Sentry we will not be able to implement this in the next couple of months, I am afraid)
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog
or Status: In Progress
, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
Hi,
I have an issue that the Sanic integration is capturing and sending exceptions to Sentry even though I have declared an exception handler using the
@app.exception
decorator as described here Sanic Exceptions. I have created a sample application that reproduces this issue. The Sentry DSN key is provided in theSENTRY_DSN
environment variable. I have tried this using python 3.7.5, 3.8.0 and 3.8.5 as well as with older versions of thesentry_sdk
library without success. I have found that the exception is being sent to sentry before the code reaches the error handler, noted by the comment in the code below.Note that if I remove the
SanicIntegration()
during initialisation of thesentry_sdk
, the application behaves as expected. Only unhandled exceptions are sent to Sentry but with less context about the exception.Is this an expected behaviour given the sample application I provided?
Application code
app.py
:Web server start command and logs:
curl command
pip freeze output