core/services/sentry.py

26 lines
946 B
Python
Raw Normal View History

2024-02-16 09:34:39 +00:00
import sentry_sdk
from sentry_sdk.integrations.ariadne import AriadneIntegration
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
from sentry_sdk.integrations.starlette import StarletteIntegration
2024-04-09 16:50:27 +00:00
from settings import GLITCHTIP_DSN
2024-02-16 09:34:39 +00:00
def start_sentry():
# sentry monitoring
try:
sentry_sdk.init(
2024-04-09 16:50:27 +00:00
GLITCHTIP_DSN,
2024-02-16 09:34:39 +00:00
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
traces_sample_rate=1.0,
# Set profiles_sample_rate to 1.0 to profile 100%
# of sampled transactions.
# We recommend adjusting this value in production.
profiles_sample_rate=1.0,
enable_tracing=True,
2024-08-06 11:34:12 +00:00
integrations=[StarletteIntegration(), AriadneIntegration(), SqlalchemyIntegration()],
2024-02-16 09:34:39 +00:00
)
except Exception as e:
2024-04-17 15:32:23 +00:00
print("[services.sentry] init error")
2024-02-16 09:34:39 +00:00
print(e)