Skip to content

Commit adce080

Browse files
committed
Create environment variables for setting sentry sample rate
1 parent 8f0f2c9 commit adce080

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

api/api.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,12 @@ async def lifespan(app: FastAPI):
217217
integrations=[FastApiIntegration()],
218218
# Enable sending logs to Sentry
219219
enable_logs=True,
220-
# Set traces_sample_rate to 1.0 to capture 100%
221-
# of transactions for tracing.
222-
traces_sample_rate=1.0,
223-
# Set profile_session_sample_rate to 1.0 to profile 100%
224-
# of profile sessions.
225-
profile_session_sample_rate=1.0,
220+
traces_sample_rate=float(os.getenv("SENTRY_TRACES_SAMPLE_RATE", "1.0")),
221+
# The profiler samples frames across threads, which can segfault the
222+
# interpreter on Python 3.11 (frame_getback race, e.g.
223+
# https://github.com/getsentry/sentry-python/issues/2386), so it is
224+
# off unless explicitly enabled.
225+
profile_session_sample_rate=float(os.getenv("SENTRY_PROFILE_SESSION_SAMPLE_RATE", "0.0")),
226226
# Set profile_lifecycle to "trace" to automatically
227227
# run the profiler on when there is an active transaction
228228
profile_lifecycle="trace",

0 commit comments

Comments
 (0)