Skip to content

Commit 90f0b67

Browse files
wedamijaandrewshie-sentry
authored andcommitted
chore(issue-platform): Clean up issue platform feature flags now that we're using flagpole (#89451)
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 aa7459a commit 90f0b67

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
@@ -80,13 +80,7 @@ def get_visible(
8080
with sentry_sdk.start_span(op="GroupTypeRegistry.get_visible") as span:
8181
released = [gt for gt in self.all() if gt.released]
8282
feature_to_grouptype = {
83-
(
84-
gt.build_visible_feature_name()
85-
if not gt.use_flagpole_for_all_features
86-
else gt.build_visible_flagpole_feature_name()
87-
): gt
88-
for gt in self.all()
89-
if not gt.released
83+
gt.build_visible_feature_name(): gt for gt in self.all() if not gt.released
9084
}
9185
batch_features = features.batch_has(
9286
list(feature_to_grouptype.keys()), actor=actor, organization=organization
@@ -188,26 +182,15 @@ class GroupType:
188182
# Defaults to true to maintain the default workflow notification behavior as it exists for error group types.
189183
enable_status_change_workflow_notifications: bool = True
190184
detector_config_schema: ClassVar[dict[str, Any]] = {}
191-
# Temporary setting so that we can slowly migrate all perf issues to use flagpole for all feature flags
192-
use_flagpole_for_all_features = False
193185

194186
def __init_subclass__(cls: type[GroupType], **kwargs: Any) -> None:
195187
super().__init_subclass__(**kwargs)
196188
registry.add(cls)
197189

198190
if not cls.released:
199191
features.add(cls.build_visible_feature_name(), OrganizationFeature, True)
200-
features.add(cls.build_ingest_feature_name(), OrganizationFeature)
201-
features.add(cls.build_post_process_group_feature_name(), OrganizationFeature)
202-
203-
# XXX: Temporary shim here. We can't use the existing feature flag names, because they're auto defined
204-
# as being option backed. So options automator isn't able to validate them and fails. We'll instead
205-
# move to new flag names
206-
features.add(cls.build_visible_flagpole_feature_name(), OrganizationFeature, True)
207-
features.add(cls.build_ingest_flagpole_feature_name(), OrganizationFeature, True)
208-
features.add(
209-
cls.build_post_process_group_flagpole_feature_name(), OrganizationFeature, True
210-
)
192+
features.add(cls.build_ingest_feature_name(), OrganizationFeature, True)
193+
features.add(cls.build_post_process_group_feature_name(), OrganizationFeature, True)
211194

212195
def __post_init__(self) -> None:
213196
valid_categories = [category.value for category in GroupCategory]
@@ -219,25 +202,14 @@ def allow_ingest(cls, organization: Organization) -> bool:
219202
if cls.released:
220203
return True
221204

222-
flag_name = (
223-
cls.build_ingest_feature_name()
224-
if not cls.use_flagpole_for_all_features
225-
else cls.build_ingest_flagpole_feature_name()
226-
)
227-
return features.has(flag_name, organization)
205+
return features.has(cls.build_ingest_feature_name(), organization)
228206

229207
@classmethod
230208
def allow_post_process_group(cls, organization: Organization) -> bool:
231209
if cls.released:
232210
return True
233211

234-
flag_name = (
235-
cls.build_post_process_group_feature_name()
236-
if not cls.use_flagpole_for_all_features
237-
else cls.build_post_process_group_flagpole_feature_name()
238-
)
239-
240-
return features.has(flag_name, organization)
212+
return features.has(cls.build_post_process_group_feature_name(), organization)
241213

242214
@classmethod
243215
def should_detect_escalation(cls) -> bool:
@@ -251,34 +223,21 @@ def build_feature_name_slug(cls) -> str:
251223
return cls.slug.replace("_", "-")
252224

253225
@classmethod
254-
def build_base_feature_name(cls, prefix: str = "") -> str:
255-
return f"organizations:{prefix}{cls.build_feature_name_slug()}"
226+
def build_base_feature_name(cls) -> str:
227+
return f"organizations:issue-{cls.build_feature_name_slug()}"
256228

257229
@classmethod
258230
def build_visible_feature_name(cls) -> str:
259231
return f"{cls.build_base_feature_name()}-visible"
260232

261-
@classmethod
262-
def build_visible_flagpole_feature_name(cls) -> str:
263-
# We'll rename this too so that all the feature names are consistent
264-
return f"{cls.build_base_feature_name("issue-")}-visible"
265-
266233
@classmethod
267234
def build_ingest_feature_name(cls) -> str:
268235
return f"{cls.build_base_feature_name()}-ingest"
269236

270-
@classmethod
271-
def build_ingest_flagpole_feature_name(cls) -> str:
272-
return f"{cls.build_base_feature_name("issue-")}-ingest"
273-
274237
@classmethod
275238
def build_post_process_group_feature_name(cls) -> str:
276239
return f"{cls.build_base_feature_name()}-post-process-group"
277240

278-
@classmethod
279-
def build_post_process_group_flagpole_feature_name(cls) -> str:
280-
return f"{cls.build_base_feature_name("issue-")}-post-process-group"
281-
282241

283242
def get_all_group_type_ids() -> set[int]:
284243
# TODO: Replace uses of this with the registry
@@ -600,7 +559,6 @@ class MetricIssuePOC(GroupType):
600559
enable_auto_resolve = False
601560
enable_escalation_detection = False
602561
enable_status_change_workflow_notifications = False
603-
use_flagpole_for_all_features = True
604562

605563

606564
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)