inbox/services/sentry.py

31 lines
1006 B
Python
Raw Normal View History

2024-04-08 06:30:57 +00:00
import sentry_sdk
from sentry_sdk.integrations.ariadne import AriadneIntegration
from sentry_sdk.integrations.redis import RedisIntegration
from sentry_sdk.integrations.starlette import StarletteIntegration
2024-04-18 10:47:01 +00:00
from services.logger import root_logger as logger
2024-04-09 17:19:46 +00:00
from settings import GLITCHTIP_DSN
2024-04-08 06:30:57 +00:00
def start_sentry():
# sentry monitoring
try:
sentry_sdk.init(
2024-04-09 17:19:46 +00:00
GLITCHTIP_DSN,
2024-04-08 06:30:57 +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,
integrations=[
StarletteIntegration(),
AriadneIntegration(),
RedisIntegration(),
],
)
except Exception as e:
2024-04-18 10:47:01 +00:00
logger.error(e)