mirror of
https://github.com/quay/quay.git
synced 2025-11-16 11:42:27 +03:00
deps: updated raven dependency to be compatible with python 3.12 (PROJQUAY-9198) (#4169)
* Updated raven dependency to be compatible with python 3.12 --------- Co-authored-by: shudeshp <shudeshp@redhat.com>
This commit is contained in:
committed by
GitHub
parent
dc8ad71acd
commit
22290c9812
@@ -1,4 +1,6 @@
|
||||
from raven.contrib.flask import Sentry as FlaskSentry
|
||||
import logging
|
||||
|
||||
import sentry_sdk
|
||||
|
||||
|
||||
class FakeSentryClient(object):
|
||||
@@ -26,7 +28,23 @@ class Sentry(object):
|
||||
sentry_type = app.config.get("EXCEPTION_LOG_TYPE", "FakeSentry")
|
||||
|
||||
if sentry_type == "Sentry":
|
||||
sentry = FlaskSentry(app, register_signal=False)
|
||||
sentry_dsn = app.config.get("SENTRY_DSN", "")
|
||||
if sentry_dsn:
|
||||
try:
|
||||
initialized_sentry = sentry_sdk.init(
|
||||
dsn=sentry_dsn,
|
||||
environment=app.config.get("SENTRY_ENVIRONMENT", "production"),
|
||||
traces_sample_rate=app.config.get("SENTRY_TRACES_SAMPLE_RATE", 0.1),
|
||||
profiles_sample_rate=app.config.get("SENTRY_PROFILES_SAMPLE_RATE", 0.1),
|
||||
)
|
||||
# Return the initialized Sentry SDK object directly
|
||||
sentry = initialized_sentry
|
||||
except Exception as e:
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.warning("Failed to initialize Sentry: %s", str(e))
|
||||
sentry = FakeSentry()
|
||||
else:
|
||||
sentry = FakeSentry()
|
||||
else:
|
||||
sentry = FakeSentry()
|
||||
|
||||
@@ -36,4 +54,6 @@ class Sentry(object):
|
||||
return sentry
|
||||
|
||||
def __getattr__(self, name):
|
||||
if self.state is None:
|
||||
return None
|
||||
return getattr(self.state, name, None)
|
||||
|
||||
Reference in New Issue
Block a user