mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-01-13 02:54:27 +00:00
avoid sending MethodNotAllowed to sentry (#1888)
Co-authored-by: burnettk <burnettk@users.noreply.github.com>
This commit is contained in:
parent
429692091a
commit
e962a0380b
@ -258,6 +258,8 @@ def should_notify_sentry(exception: Exception) -> bool:
|
||||
return False
|
||||
|
||||
# like a 404, 405 Method Not Allowed: The method is not allowed for the requested URL
|
||||
# it doesn't seem to work to exclude this here. i guess it happens before it gets to our app?
|
||||
# excluded via before_send in configure_sentry
|
||||
if isinstance(exception, MethodNotAllowed):
|
||||
return False
|
||||
|
||||
|
@ -8,6 +8,7 @@ import flask.wrappers
|
||||
import sentry_sdk
|
||||
from prometheus_flask_exporter import ConnexionPrometheusMetrics # type: ignore
|
||||
from sentry_sdk.integrations.flask import FlaskIntegration
|
||||
from werkzeug.exceptions import MethodNotAllowed
|
||||
from werkzeug.exceptions import NotFound
|
||||
|
||||
|
||||
@ -60,6 +61,8 @@ def configure_sentry(app: flask.app.Flask) -> None:
|
||||
# NotFound is mostly from web crawlers
|
||||
if isinstance(exc_value, NotFound):
|
||||
return None
|
||||
if isinstance(exc_value, MethodNotAllowed):
|
||||
return None
|
||||
return event
|
||||
|
||||
sentry_errors_sample_rate = app.config.get("SPIFFWORKFLOW_BACKEND_SENTRY_ERRORS_SAMPLE_RATE")
|
||||
|
Loading…
x
Reference in New Issue
Block a user