Skip to content

Commit 6d83556

Browse files
committed
chore(issue-platform): Clean up issue platform feature flags now that we're using flagpole
We've migrated all grouptypes to either be released or using flagpole. We can remove all this transition code. Should be merged after - getsentry/getsentry#17207 - #89446
1 parent 925c81c commit 6d83556

File tree

9 files changed

+16
-65
lines changed

9 files changed

+16
-65
lines changed

src/sentry/incidents/grouptype.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def get_group_key_values(
7272
# like these when we're sending issues as alerts
7373
@dataclass(frozen=True)
7474
class MetricAlertFire(GroupType):
75-
use_flagpole_for_all_features = True
7675
type_id = 8001
7776
slug = "metric_alert_fire"
7877
description = "Metric alert fired"

src/sentry/issues/grouptype.py

Lines changed: 7 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,7 @@ def get_visible(
7474
with sentry_sdk.start_span(op="GroupTypeRegistry.get_visible") as span:
7575
released = [gt for gt in self.all() if gt.released]
7676
feature_to_grouptype = {
77-
(
78-
gt.build_visible_feature_name()
79-
if not gt.use_flagpole_for_all_features
80-
else gt.build_visible_flagpole_feature_name()
81-
): gt
82-
for gt in self.all()
83-
if not gt.released
77+
gt.build_visible_feature_name(): gt for gt in self.all() if not gt.released
8478
}
8579
batch_features = features.batch_has(
8680
list(feature_to_grouptype.keys()), actor=actor, organization=organization
@@ -182,26 +176,15 @@ class GroupType:
182176
# Defaults to true to maintain the default workflow notification behavior as it exists for error group types.
183177
enable_status_change_workflow_notifications: bool = True
184178
detector_config_schema: ClassVar[dict[str, Any]] = {}
185-
# Temporary setting so that we can slowly migrate all perf issues to use flagpole for all feature flags
186-
use_flagpole_for_all_features = False
187179

188180
def __init_subclass__(cls: type[GroupType], **kwargs: Any) -> None:
189181
super().__init_subclass__(**kwargs)
190182
registry.add(cls)
191183

192184
if not cls.released:
193185
features.add(cls.build_visible_feature_name(), OrganizationFeature, True)
194-
features.add(cls.build_ingest_feature_name(), OrganizationFeature)
195-
features.add(cls.build_post_process_group_feature_name(), OrganizationFeature)
196-
197-
# XXX: Temporary shim here. We can't use the existing feature flag names, because they're auto defined
198-
# as being option backed. So options automator isn't able to validate them and fails. We'll instead
199-
# move to new flag names
200-
features.add(cls.build_visible_flagpole_feature_name(), OrganizationFeature, True)
201-
features.add(cls.build_ingest_flagpole_feature_name(), OrganizationFeature, True)
202-
features.add(
203-
cls.build_post_process_group_flagpole_feature_name(), OrganizationFeature, True
204-
)
186+
features.add(cls.build_ingest_feature_name(), OrganizationFeature, True)
187+
features.add(cls.build_post_process_group_feature_name(), OrganizationFeature, True)
205188

206189
def __post_init__(self) -> None:
207190
valid_categories = [category.value for category in GroupCategory]
@@ -213,25 +196,14 @@ def allow_ingest(cls, organization: Organization) -> bool:
213196
if cls.released:
214197
return True
215198

216-
flag_name = (
217-
cls.build_ingest_feature_name()
218-
if not cls.use_flagpole_for_all_features
219-
else cls.build_ingest_flagpole_feature_name()
220-
)
221-
return features.has(flag_name, organization)
199+
return features.has(cls.build_ingest_feature_name(), organization)
222200

223201
@classmethod
224202
def allow_post_process_group(cls, organization: Organization) -> bool:
225203
if cls.released:
226204
return True
227205

228-
flag_name = (
229-
cls.build_post_process_group_feature_name()
230-
if not cls.use_flagpole_for_all_features
231-
else cls.build_post_process_group_flagpole_feature_name()
232-
)
233-
234-
return features.has(flag_name, organization)
206+
return features.has(cls.build_post_process_group_feature_name(), organization)
235207

236208
@classmethod
237209
def should_detect_escalation(cls) -> bool:
@@ -245,34 +217,21 @@ def build_feature_name_slug(cls) -> str:
245217
return cls.slug.replace("_", "-")
246218

247219
@classmethod
248-
def build_base_feature_name(cls, prefix: str = "") -> str:
249-
return f"organizations:{prefix}{cls.build_feature_name_slug()}"
220+
def build_base_feature_name(cls) -> str:
221+
return f"organizations:issue-{cls.build_feature_name_slug()}"
250222

251223
@classmethod
252224
def build_visible_feature_name(cls) -> str:
253225
return f"{cls.build_base_feature_name()}-visible"
254226

255-
@classmethod
256-
def build_visible_flagpole_feature_name(cls) -> str:
257-
# We'll rename this too so that all the feature names are consistent
258-
return f"{cls.build_base_feature_name("issue-")}-visible"
259-
260227
@classmethod
261228
def build_ingest_feature_name(cls) -> str:
262229
return f"{cls.build_base_feature_name()}-ingest"
263230

264-
@classmethod
265-
def build_ingest_flagpole_feature_name(cls) -> str:
266-
return f"{cls.build_base_feature_name("issue-")}-ingest"
267-
268231
@classmethod
269232
def build_post_process_group_feature_name(cls) -> str:
270233
return f"{cls.build_base_feature_name()}-post-process-group"
271234

272-
@classmethod
273-
def build_post_process_group_flagpole_feature_name(cls) -> str:
274-
return f"{cls.build_base_feature_name("issue-")}-post-process-group"
275-
276235

277236
def get_all_group_type_ids() -> set[int]:
278237
# TODO: Replace uses of this with the registry
@@ -594,7 +553,6 @@ class MetricIssuePOC(GroupType):
594553
enable_auto_resolve = False
595554
enable_escalation_detection = False
596555
enable_status_change_workflow_notifications = False
597-
use_flagpole_for_all_features = True
598556

599557

600558
def should_create_group(

src/sentry/runner/commands/createflag.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ def createissueflag(
204204
click.echo("")
205205
click.echo("=== GENERATED YAML ===\n")
206206
for feature_name in [
207-
group_type.build_visible_flagpole_feature_name(),
208-
group_type.build_ingest_flagpole_feature_name(),
209-
group_type.build_post_process_group_flagpole_feature_name(),
207+
group_type.build_visible_feature_name(),
208+
group_type.build_ingest_feature_name(),
209+
group_type.build_post_process_group_feature_name(),
210210
]:
211211

212212
feature = Feature(

src/sentry/uptime/grouptype.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from dataclasses import dataclass
44

5-
from sentry.issues import grouptype
65
from sentry.issues.grouptype import GroupCategory, GroupType
76
from sentry.ratelimits.sliding_windows import Quota
87
from sentry.types.group import PriorityLevel
@@ -33,8 +32,3 @@ class UptimeDomainCheckFailure(GroupType):
3332
},
3433
"additionalProperties": False,
3534
}
36-
use_flagpole_for_all_features = True
37-
38-
39-
# XXX: Temporary hack to work around pickling issues
40-
grouptype.UptimeDomainCheckFailure = UptimeDomainCheckFailure # type: ignore[attr-defined]

tests/sentry/incidents/utils/test_metric_issue_poc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from tests.sentry.issues.test_occurrence_consumer import IssueOccurrenceTestBase
1313

1414

15-
@apply_feature_flag_on_cls(MetricIssuePOC.build_ingest_flagpole_feature_name())
15+
@apply_feature_flag_on_cls(MetricIssuePOC.build_ingest_feature_name())
1616
@apply_feature_flag_on_cls("projects:metric-issue-creation")
1717
class TestMetricIssuePOC(IssueOccurrenceTestBase, APITestCase):
1818
def setUp(self):

tests/sentry/issues/test_grouptype.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ def test_get_visible(self) -> None:
162162
registry.add(UptimeDomainCheckFailure)
163163
registry.add(MetricIssuePOC)
164164
assert registry.get_visible(self.organization) == []
165-
with self.feature(UptimeDomainCheckFailure.build_visible_flagpole_feature_name()):
165+
with self.feature(UptimeDomainCheckFailure.build_visible_feature_name()):
166166
assert registry.get_visible(self.organization) == [UptimeDomainCheckFailure]
167167
registry.add(ErrorGroupType)
168-
with self.feature(UptimeDomainCheckFailure.build_visible_flagpole_feature_name()):
168+
with self.feature(UptimeDomainCheckFailure.build_visible_feature_name()):
169169
assert set(registry.get_visible(self.organization)) == {
170170
UptimeDomainCheckFailure,
171171
ErrorGroupType,

tests/sentry/uptime/consumers/test_results_consumer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def send_result(
7979
datetime.now(),
8080
)
8181
)
82-
with self.feature(UptimeDomainCheckFailure.build_ingest_flagpole_feature_name()):
82+
with self.feature(UptimeDomainCheckFailure.build_ingest_feature_name()):
8383
if consumer is None:
8484
factory = UptimeResultsStrategyFactory(mode=self.strategy_processing_mode)
8585
commit = mock.Mock()

tests/sentry/uptime/subscriptions/test_subscriptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ def test(self, mock_disable_seat):
692692
def test_disable_failed(self, mock_disable_seat):
693693
with (
694694
self.tasks(),
695-
self.feature(UptimeDomainCheckFailure.build_ingest_flagpole_feature_name()),
695+
self.feature(UptimeDomainCheckFailure.build_ingest_feature_name()),
696696
):
697697
proj_sub = create_project_uptime_subscription(
698698
self.project,

tests/sentry/uptime/test_issue_platform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def test(self):
119119
uptime_subscription=subscription
120120
)
121121
result = self.create_uptime_result(subscription.subscription_id)
122-
with self.feature(UptimeDomainCheckFailure.build_ingest_flagpole_feature_name()):
122+
with self.feature(UptimeDomainCheckFailure.build_ingest_feature_name()):
123123
create_issue_platform_occurrence(result, project_subscription)
124124
hashed_fingerprint = md5(str(project_subscription.id).encode("utf-8")).hexdigest()
125125
group = Group.objects.get(grouphash__hash=hashed_fingerprint)

0 commit comments

Comments
 (0)