maximedenes commited on
Commit
5f010ab
Β·
1 Parent(s): e8055f2

Add back monitoring if DSN is defined

Browse files
Files changed (2) hide show
  1. backend/app/asgi.py +18 -0
  2. backend/app/config/base.py +4 -1
backend/app/asgi.py CHANGED
@@ -2,6 +2,7 @@
2
  ASGI entry point for the Open LLM Leaderboard API.
3
  """
4
  import os
 
5
  import uvicorn
6
  import logging
7
  import logging.config
@@ -64,6 +65,23 @@ LOGGING_CONFIG = {
64
  logging.config.dictConfig(LOGGING_CONFIG)
65
  logger = logging.getLogger("app")
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  # Create FastAPI application
68
  app = FastAPI(
69
  title="Open LLM Leaderboard",
 
2
  ASGI entry point for the Open LLM Leaderboard API.
3
  """
4
  import os
5
+ from backend.app.config.base import SENTRY_DSN
6
  import uvicorn
7
  import logging
8
  import logging.config
 
65
  logging.config.dictConfig(LOGGING_CONFIG)
66
  logger = logging.getLogger("app")
67
 
68
+ if SENTRY_DSN is not None:
69
+ sentry_sdk.init(
70
+ dsn=SENTRY_DSN,
71
+ # Add data like request headers and IP for users,
72
+ # see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
73
+ send_default_pii=False,
74
+ # Set traces_sample_rate to 1.0 to capture 100%
75
+ # of transactions for tracing.
76
+ traces_sample_rate=1.0,
77
+ _experiments={
78
+ # Set continuous_profiling_auto_start to True
79
+ # to automatically start the profiler on when
80
+ # possible.
81
+ "continuous_profiling_auto_start": True,
82
+ },
83
+ )
84
+
85
  # Create FastAPI application
86
  app = FastAPI(
87
  title="Open LLM Leaderboard",
backend/app/config/base.py CHANGED
@@ -32,4 +32,7 @@ DATASETS_CACHE = CACHE_ROOT / "datasets"
32
  MODELS_CACHE = CACHE_ROOT / "models"
33
  VOTES_CACHE = CACHE_ROOT / "votes"
34
  EVAL_CACHE = CACHE_ROOT / "eval-queue"
35
- RESULTS_CACHE = CACHE_ROOT / "results"
 
 
 
 
32
  MODELS_CACHE = CACHE_ROOT / "models"
33
  VOTES_CACHE = CACHE_ROOT / "votes"
34
  EVAL_CACHE = CACHE_ROOT / "eval-queue"
35
+ RESULTS_CACHE = CACHE_ROOT / "results"
36
+
37
+ # Monitoring
38
+ SENTRY_DSN = os.environ.get("SENTRY_DSN")