Skip to content

Commit 6cd7c04

Browse files
authored
feat(sdk): Add sampling multiplier config as an intermediate step to 100% sampling (#52104)
We want to eventually end up in a state where we sample at 100% client (sdk) side. Not being sure about the impact of just turning this on throughout the system, we will do it in steps with the new `SENTRY_MULTIPLIER_APM_SAMPLING` config that we will bump in steps, first on isolated instances and then everywhere till we either * get to 100% sampling * find and document problems that we can handle via [backpressure management](getsentry/sentry-python#2189) in SDKs
1 parent fd47c83 commit 6cd7c04

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/sentry/conf/server.py

+3
Original file line numberDiff line numberDiff line change
@@ -1768,6 +1768,9 @@ def SOCIAL_AUTH_DEFAULT_USERNAME() -> str:
17681768
# sample rate for all reprocessing tasks (except for the per-event ones)
17691769
SENTRY_REPROCESSING_APM_SAMPLING = 0
17701770

1771+
# upsampling multiplier that we'll increase in steps till we're at 100% throughout
1772+
SENTRY_MULTIPLIER_APM_SAMPLING = 1
1773+
17711774
# ----
17721775
# end APM config
17731776
# ----

src/sentry/utils/sdk.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,14 @@ def traces_sampler(sampling_context):
269269
pass
270270

271271
# Default to the sampling rate in settings
272-
return float(settings.SENTRY_BACKEND_APM_SAMPLING or 0)
272+
rate = float(settings.SENTRY_BACKEND_APM_SAMPLING or 0)
273+
274+
# multiply everything with the overall multiplier
275+
# till we get to 100% client sampling throughout
276+
if settings.SENTRY_MULTIPLIER_APM_SAMPLING:
277+
rate = min(1, rate * settings.SENTRY_MULTIPLIER_APM_SAMPLING)
278+
279+
return rate
273280

274281

275282
def before_send_transaction(event, _):

0 commit comments

Comments
 (0)