Skip to content

Commit

Permalink
feat(sdk): Add sampling multiplier config as an intermediate step to …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
sl0thentr0py committed Jul 10, 2023
1 parent fd47c83 commit 6cd7c04
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/sentry/conf/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1768,6 +1768,9 @@ def SOCIAL_AUTH_DEFAULT_USERNAME() -> str:
# sample rate for all reprocessing tasks (except for the per-event ones)
SENTRY_REPROCESSING_APM_SAMPLING = 0

# upsampling multiplier that we'll increase in steps till we're at 100% throughout
SENTRY_MULTIPLIER_APM_SAMPLING = 1

# ----
# end APM config
# ----
Expand Down
9 changes: 8 additions & 1 deletion src/sentry/utils/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,14 @@ def traces_sampler(sampling_context):
pass

# Default to the sampling rate in settings
return float(settings.SENTRY_BACKEND_APM_SAMPLING or 0)
rate = float(settings.SENTRY_BACKEND_APM_SAMPLING or 0)

# multiply everything with the overall multiplier
# till we get to 100% client sampling throughout
if settings.SENTRY_MULTIPLIER_APM_SAMPLING:
rate = min(1, rate * settings.SENTRY_MULTIPLIER_APM_SAMPLING)

return rate


def before_send_transaction(event, _):
Expand Down

0 comments on commit 6cd7c04

Please sign in to comment.