Skip to content

feat(dynamic-sampling): add sliding window calculation to per-org#116083

Merged
shellmayr merged 7 commits into
masterfrom
shellmayr/feat/add-sliding-window-calculation-ds-per-org
May 28, 2026
Merged

feat(dynamic-sampling): add sliding window calculation to per-org#116083
shellmayr merged 7 commits into
masterfrom
shellmayr/feat/add-sliding-window-calculation-ds-per-org

Conversation

@shellmayr
Copy link
Copy Markdown
Member

@shellmayr shellmayr commented May 22, 2026

  • Sliding window retrieves the total 24h volume from EAP, extrapolates to the monthly volume, and then gets the sample rate from getsentry's tier system
  • If available, this sample rate is used as the base for project sample rates for the automatic configurations
  • Add the sliding window calculation to the new per-org pipeline

Contributes to TET-2233

@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 22, 2026

TET-2233

@shellmayr shellmayr requested a review from constantinius May 22, 2026 09:27
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 22, 2026
Comment thread src/sentry/dynamic_sampling/per_org/tasks/configuration.py
@shellmayr shellmayr marked this pull request as ready for review May 22, 2026 11:25
@shellmayr shellmayr requested a review from a team as a code owner May 22, 2026 11:25
Comment thread src/sentry/dynamic_sampling/per_org/tasks/configuration.py
Comment thread src/sentry/dynamic_sampling/per_org/tasks/configuration.py
Comment thread src/sentry/dynamic_sampling/per_org/tasks/configuration.py
Comment thread src/sentry/dynamic_sampling/per_org/tasks/configuration.py
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit dfbd894. Configure here.

except ObjectDoesNotExist as exc:
raise DynamicSamplingException(DynamicSamplingStatus.NO_SUBSCRIPTION) from exc
self.projects = self._get_projects()
self.sliding_window_sample_rate = self._get_sliding_window_sample_rate()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary EAP query when blended sample rate is None

Low Severity

_get_sliding_window_sample_rate() executes a 24-hour EAP query unconditionally during __init__, even when self.sample_rate is None. Since is_enabled only checks self.sample_rate, a None value causes get_configuration() to discard the entire configuration object and return NoDynamicSamplingConfiguration(). The sliding window query result is never used in that path, making it wasted work for every org in the rollout that lacks a blended sample rate.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit dfbd894. Configure here.

@shellmayr shellmayr merged commit b0870c6 into master May 28, 2026
64 checks passed
@shellmayr shellmayr deleted the shellmayr/feat/add-sliding-window-calculation-ds-per-org branch May 28, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants