maximedenes commited on
Commit
0fe203b
Β·
1 Parent(s): 698196c

Send error events to sentry (without PII)

Browse files
Files changed (2) hide show
  1. backend/app/asgi.py +17 -0
  2. backend/pyproject.toml +1 -0
backend/app/asgi.py CHANGED
@@ -9,6 +9,7 @@ from fastapi import FastAPI
9
  from fastapi.middleware.cors import CORSMiddleware
10
  from fastapi.middleware.gzip import GZipMiddleware
11
  import sys
 
12
 
13
  from app.api.router import router
14
  from app.core.fastapi_cache import setup_cache
@@ -63,6 +64,22 @@ LOGGING_CONFIG = {
63
  logging.config.dictConfig(LOGGING_CONFIG)
64
  logger = logging.getLogger("app")
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  # Create FastAPI application
67
  app = FastAPI(
68
  title="Open LLM Leaderboard",
 
9
  from fastapi.middleware.cors import CORSMiddleware
10
  from fastapi.middleware.gzip import GZipMiddleware
11
  import sys
12
+ import sentry_sdk
13
 
14
  from app.api.router import router
15
  from app.core.fastapi_cache import setup_cache
 
64
  logging.config.dictConfig(LOGGING_CONFIG)
65
  logger = logging.getLogger("app")
66
 
67
+ sentry_sdk.init(
68
+ dsn="https://aeadf8ea37d94843a226d8616f173b30@o4508776892268544.ingest.de.sentry.io/4508776897314896",
69
+ # Add data like request headers and IP for users,
70
+ # see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
71
+ send_default_pii=False,
72
+ # Set traces_sample_rate to 1.0 to capture 100%
73
+ # of transactions for tracing.
74
+ traces_sample_rate=1.0,
75
+ _experiments={
76
+ # Set continuous_profiling_auto_start to True
77
+ # to automatically start the profiler on when
78
+ # possible.
79
+ "continuous_profiling_auto_start": True,
80
+ },
81
+ )
82
+
83
  # Create FastAPI application
84
  app = FastAPI(
85
  title="Open LLM Leaderboard",
backend/pyproject.toml CHANGED
@@ -19,6 +19,7 @@ safetensors = "^0.4.5"
19
  aiofiles = "^24.1.0"
20
  fastapi-cache2 = "^0.2.1"
21
  python-dotenv = "^1.0.1"
 
22
 
23
  [tool.poetry.group.dev.dependencies]
24
  pytest = "^8.3.4"
 
19
  aiofiles = "^24.1.0"
20
  fastapi-cache2 = "^0.2.1"
21
  python-dotenv = "^1.0.1"
22
+ sentry-sdk = {extras = ["fastapi"], version = "^2.20.0"}
23
 
24
  [tool.poetry.group.dev.dependencies]
25
  pytest = "^8.3.4"