ref(dynamic-sampling): remove all usage of custom ds rules in code#110979
Merged
shellmayr merged 10 commits intoMar 31, 2026
Conversation
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Removed constant still imported causing runtime ImportError
- Removed the import of CUSTOM_RULE_START and its reference in RESERVED_IDS dictionary since the constant was removed from sentry.models.dynamicsampling.
Or push these changes by commenting:
@cursor push 8bd6f6a9c0
Preview (8bd6f6a9c0)
diff --git a/src/sentry/dynamic_sampling/rules/utils.py b/src/sentry/dynamic_sampling/rules/utils.py
--- a/src/sentry/dynamic_sampling/rules/utils.py
+++ b/src/sentry/dynamic_sampling/rules/utils.py
@@ -6,7 +6,6 @@
from django.conf import settings
from redis import StrictRedis
-from sentry.models.dynamicsampling import CUSTOM_RULE_START
from sentry.relay.types import RuleCondition
from sentry.utils import redis
@@ -73,7 +72,6 @@
RuleType.MINIMUM_SAMPLE_RATE_RULE: 1006,
RuleType.BOOST_LOW_VOLUME_TRANSACTIONS_RULE: 1400,
RuleType.BOOST_LATEST_RELEASES_RULE: 1500,
- RuleType.CUSTOM_RULE: CUSTOM_RULE_START,
}
REVERSE_RESERVED_IDS = {value: key for key, value in RESERVED_IDS.items()}This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
obostjancic
approved these changes
Mar 19, 2026
Contributor
Backend Test FailuresFailures on
|
1ba8b2e to
b180ec6
Compare
markstory
approved these changes
Mar 20, 2026
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Model removed from merge coverage but still has User FK
- Added CustomDynamicSamplingRule back to @expect_models decorators, model_list, and set created_by_id=owner_id in the fixture to ensure the model is properly tested for user merge coverage.
Or push these changes by commenting:
@cursor push aff5a71e10
Preview (aff5a71e10)
diff --git a/src/sentry/organizations/services/organization/impl.py b/src/sentry/organizations/services/organization/impl.py
--- a/src/sentry/organizations/services/organization/impl.py
+++ b/src/sentry/organizations/services/organization/impl.py
@@ -20,6 +20,7 @@
from sentry.incidents.models.incident import IncidentActivity
from sentry.models.activity import Activity
from sentry.models.dashboard import Dashboard, DashboardFavoriteUser
+from sentry.models.dynamicsampling import CustomDynamicSamplingRule
from sentry.models.groupassignee import GroupAssignee
from sentry.models.groupbookmark import GroupBookmark
from sentry.models.groupsearchview import GroupSearchView
@@ -580,6 +581,7 @@
Activity,
AlertRule,
AlertRuleActivity,
+ CustomDynamicSamplingRule,
Dashboard,
DashboardFavoriteUser,
GroupAssignee,
diff --git a/src/sentry/testutils/helpers/backups.py b/src/sentry/testutils/helpers/backups.py
--- a/src/sentry/testutils/helpers/backups.py
+++ b/src/sentry/testutils/helpers/backups.py
@@ -826,6 +826,7 @@
num_samples=100,
condition_hash="abc123def456abc123def456abc123def4560000",
sample_rate=0.5,
+ created_by_id=owner_id,
)
CustomDynamicSamplingRuleProject.objects.create(
custom_dynamic_sampling_rule=custom_rule,
diff --git a/tests/sentry/users/models/test_user.py b/tests/sentry/users/models/test_user.py
--- a/tests/sentry/users/models/test_user.py
+++ b/tests/sentry/users/models/test_user.py
@@ -13,6 +13,7 @@
from sentry.models.activity import Activity
from sentry.models.authidentity import AuthIdentity
from sentry.models.dashboard import Dashboard, DashboardFavoriteUser
+from sentry.models.dynamicsampling import CustomDynamicSamplingRule
from sentry.models.groupassignee import GroupAssignee
from sentry.models.groupbookmark import GroupBookmark
from sentry.models.groupsearchview import GroupSearchView
@@ -382,6 +383,7 @@
Activity,
AlertRule,
AlertRuleActivity,
+ CustomDynamicSamplingRule,
Dashboard,
DashboardFavoriteUser,
GroupAssignee,
@@ -425,6 +427,7 @@
Activity,
AlertRule,
AlertRuleActivity,
+ CustomDynamicSamplingRule,
Dashboard,
DashboardFavoriteUser,
GroupAssignee,This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
Contributor
|
PR reverted: 005905e |
Contributor
Backend Test FailuresFailures on
|
dashed
pushed a commit
that referenced
this pull request
Apr 1, 2026
…110979) - Remove rule hash function - Remove constants - Remove all methods on custom dynamic sampling rules before removal of the model Contributes to TET-1957
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.


Contributes to TET-1957