feat(dynamic-sampling): Add per-project sample rate override for custom DS#117796
Merged
shellmayr merged 4 commits intoJun 17, 2026
Merged
Conversation
…om DS Allow pinning specific projects to a fixed dynamic sampling rate out-of-band via the dynamic-sampling.sample-rate-override-per-project option (a map of project id to rate). Previously the custom (AM3) dynamic sampling path had no override hook -- the existing getsentry override only wraps the blended/automatic rate, which the custom path never calls. The override hard-replaces the resolved rate in both custom-DS paths: - Legacy path: get_guarded_project_sample_rate, winning over org/project targets and the recently-added/rebalanced rate. - New per-org path: applied as an explicit apply_project_sample_rate_overrides step in the scheduler after balancing, so it is surfaced in the pipeline and feeds the cached rates and transaction balancing. Out-of-range or invalid values are ignored. Also adds tests covering both paths and the AM3 organization-mode sample rate behavior. Refs TET-2490 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…rg mode Add tests for the per-project override applied in get_guarded_project_sample_rate (override wins over the recently-added boost; out-of-range values ignored) and for the AM3 organization-mode sample rate being the configured target regardless of ingested volume. Refs TET-2490 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Remove the AM3 organization-mode high-volume tests that are unrelated to the per-project sample rate override; keep only the override tests. Refs TET-2490 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
apply_project_sample_rate_overrides called get_sample_rate_override_for_project
per project, which read the option on every call. Add get_sample_rate_overrides
that reads and validates the option once into a {project_id: rate} map; the batch
path builds it once and intersects against it, and the single-project helper now
delegates to it.
Refs TET-2490
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7db4245. Configure here.
billyvg
pushed a commit
that referenced
this pull request
Jun 17, 2026
…om DS (#117796) - Add `dynamic-sampling.sample-rate-override-per-project` option — a map of stringified project id → fixed sample rate — to pin specific projects to a known rate out-of-band - Closes the gap where the custom (AM3) DS path had no override hook (the existing getsentry override only wraps the blended/automatic rate, which the custom path never calls) - **Legacy path:** apply the override in `get_guarded_project_sample_rate`, winning over org/project targets and the recently-added/rebalanced rate - **New per-org path:** apply it as an explicit `apply_project_sample_rate_overrides` step in the scheduler after balancing, so it's surfaced in the pipeline and feeds the cached rates + transaction balancing - Out-of-range/invalid values are ignored (hard-replace semantics otherwise) - Tests cover both paths, no-op-without-option, and the AM3 organization-mode baseline behavior Contributes to TET-2490 --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
sehr-m
pushed a commit
that referenced
this pull request
Jun 23, 2026
…om DS (#117796) - Add `dynamic-sampling.sample-rate-override-per-project` option — a map of stringified project id → fixed sample rate — to pin specific projects to a known rate out-of-band - Closes the gap where the custom (AM3) DS path had no override hook (the existing getsentry override only wraps the blended/automatic rate, which the custom path never calls) - **Legacy path:** apply the override in `get_guarded_project_sample_rate`, winning over org/project targets and the recently-added/rebalanced rate - **New per-org path:** apply it as an explicit `apply_project_sample_rate_overrides` step in the scheduler after balancing, so it's surfaced in the pipeline and feeds the cached rates + transaction balancing - Out-of-range/invalid values are ignored (hard-replace semantics otherwise) - Tests cover both paths, no-op-without-option, and the AM3 organization-mode baseline behavior Contributes to TET-2490 --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

dynamic-sampling.sample-rate-override-per-projectoption — a map of stringified project id → fixed sample rate — to pin specific projects to a known rate out-of-bandget_guarded_project_sample_rate, winning over org/project targets and the recently-added/rebalanced rateapply_project_sample_rate_overridesstep in the scheduler after balancing, so it's surfaced in the pipeline and feeds the cached rates + transaction balancingContributes to TET-2490