File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -59,11 +59,26 @@ def __init__(self):
5959
6060 def setup_sentry (self ):
6161 if os .getenv ("ENV" ) == "production" :
62- sentry_sdk .init (
63- dsn = os .getenv ("SENTRY_DSN" ),
64- traces_sample_rate = 0.25 ,
65- profiles_sample_rate = 1.0 ,
66- )
62+ try :
63+ # Explicitly configure integrations to avoid auto-enabling Strawberry
64+ # which causes crashes when Strawberry is not installed
65+ from sentry_sdk .integrations .fastapi import FastApiIntegration
66+ from sentry_sdk .integrations .logging import LoggingIntegration
67+ from sentry_sdk .integrations .stdlib import StdlibIntegration
68+
69+ sentry_sdk .init (
70+ dsn = os .getenv ("SENTRY_DSN" ),
71+ traces_sample_rate = 0.25 ,
72+ profiles_sample_rate = 1.0 ,
73+ default_integrations = False ,
74+ integrations = [
75+ FastApiIntegration (),
76+ LoggingIntegration (),
77+ StdlibIntegration (),
78+ ],
79+ )
80+ except Exception as e :
81+ logging .warning (f"Sentry initialization failed (non-fatal): { e } " )
6782
6883 def setup_phoenix_tracing (self ):
6984 try :
You can’t perform that action at this time.
0 commit comments