28 lines
736 B
Python
28 lines
736 B
Python
|
import os
|
||
|
import sentry_sdk
|
||
|
|
||
|
from dotenv import find_dotenv, load_dotenv
|
||
|
from typing import Union
|
||
|
|
||
|
from sentry_sdk.integrations.fastapi import FastApiIntegration
|
||
|
from sentry_sdk.integrations.loguru import LoguruIntegration
|
||
|
from sentry_sdk.integrations.redis import RedisIntegration
|
||
|
|
||
|
from Craft.enums import LoggingLevel
|
||
|
|
||
|
load_dotenv(find_dotenv())
|
||
|
|
||
|
class Sentry:
|
||
|
def __init__(self):
|
||
|
self.sentry_dsn = os.getenv("SENTRY_DSN")
|
||
|
sentry_sdk.init(
|
||
|
dsn=self.sentry_dsn,
|
||
|
integrations=[
|
||
|
FastApiIntegration(),
|
||
|
LoguruIntegration(),
|
||
|
RedisIntegration(),
|
||
|
],
|
||
|
traces_sample_rate=1.0,
|
||
|
profiles_sample_rate=1.0,
|
||
|
)
|