Skip to content

Commit c0d6ba7

Browse files
authored
fix(aci): necessary flag changes (#103087)
- Set metric issue ingest/post-process flags to true so that metric issues can work for self-hosted - Tie metric issue visibility to the UI flag so that rollout is smooth - Tie new links to the UI flag
1 parent 4d27451 commit c0d6ba7

File tree

22 files changed

+44
-47
lines changed

22 files changed

+44
-47
lines changed

src/sentry/digests/notifications.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def event_to_record(
8989
assert event.group is not None
9090
rule_ids = []
9191
identifier_key = IdentifierKey.RULE
92-
if features.has("organizations:workflow-engine-ui-links", event.organization):
92+
if features.has("organizations:workflow-engine-ui", event.organization):
9393
identifier_key = IdentifierKey.WORKFLOW
9494
for rule in rules:
9595
rule_ids.append(int(get_key_from_rule_data(rule, "workflow_id")))
@@ -194,7 +194,7 @@ def get_rules_from_workflows(project: Project, workflow_ids: set[int]) -> dict[i
194194

195195
# We are only processing the workflows in the digest if under the new flag
196196
# This should be ok since we should only add workflow_ids to redis when under this flag
197-
if features.has("organizations:workflow-engine-ui-links", project.organization):
197+
if features.has("organizations:workflow-engine-ui", project.organization):
198198
for workflow_id, workflow in workflows.items():
199199
assert (
200200
workflow.organization_id == project.organization_id

src/sentry/incidents/action_handlers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ def generate_incident_trigger_email_context(
582582
if notification_uuid:
583583
alert_link_params["notification_uuid"] = notification_uuid
584584

585-
if features.has("organizations:workflow-engine-ui-links", organization):
585+
if features.has("organizations:workflow-engine-ui", organization):
586586
assert (
587587
metric_issue_context.group is not None
588588
), "Group should not be None when workflow engine ui links are enabled"
@@ -632,7 +632,7 @@ def generate_incident_trigger_email_context(
632632
snooze_alert = False
633633
# We don't have user muting for workflows in the new workflow engine system
634634
# so we don't need to show the snooze alert url
635-
if not features.has("organizations:workflow-engine-ui-links", organization):
635+
if not features.has("organizations:workflow-engine-ui", organization):
636636
snooze_alert = True
637637
snooze_alert_url = alert_link + "&" + urlencode({"mute": "1"})
638638

src/sentry/incidents/grouptype.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,3 +354,15 @@ class MetricIssue(GroupType):
354354
},
355355
},
356356
)
357+
358+
@classmethod
359+
def allow_ingest(cls, organization: Organization) -> bool:
360+
return True
361+
362+
@classmethod
363+
def allow_post_process_group(cls, organization: Organization) -> bool:
364+
return True
365+
366+
@classmethod
367+
def build_visible_feature_name(cls) -> str:
368+
return "organizations:workflow-engine-ui"

src/sentry/integrations/discord/message_builder/issues.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def build(self, notification_uuid: str | None = None) -> DiscordMessage:
6262
rule_environment_id = None
6363
if self.rules:
6464
rule_environment_id = self.rules[0].environment_id
65-
if features.has("organizations:workflow-engine-ui-links", self.group.organization):
65+
if features.has("organizations:workflow-engine-ui", self.group.organization):
6666
rule_id = int(get_key_from_rule_data(self.rules[0], "workflow_id"))
6767
elif should_fire_workflow_actions(self.group.organization, self.group.type):
6868
rule_id = int(get_key_from_rule_data(self.rules[0], "legacy_rule_id"))
@@ -71,7 +71,7 @@ def build(self, notification_uuid: str | None = None) -> DiscordMessage:
7171

7272
url = None
7373

74-
if features.has("organizations:workflow-engine-ui-links", self.group.organization):
74+
if features.has("organizations:workflow-engine-ui", self.group.organization):
7575
url = get_title_link_workflow_engine_ui(
7676
self.group,
7777
self.event,

src/sentry/integrations/messaging/message_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def build_footer(
292292
) -> str:
293293
footer = f"{group.qualified_short_id}"
294294
if rules:
295-
if features.has("organizations:workflow-engine-ui-links", group.organization):
295+
if features.has("organizations:workflow-engine-ui", group.organization):
296296
rule_url = absolute_uri(
297297
create_link_to_workflow(
298298
group.organization.id, get_key_from_rule_data(rules[0], "workflow_id")

src/sentry/integrations/metric_alerts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def incident_attachment_info(
253253

254254
title_link = build_title_link(alert_rule_id, organization, workflow_engine_params)
255255

256-
elif features.has("organizations:workflow-engine-ui-links", organization):
256+
elif features.has("organizations:workflow-engine-ui", organization):
257257
if metric_issue_context.group is None:
258258
raise ValueError("Group is required for workflow engine UI links")
259259

src/sentry/integrations/opsgenie/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def build_issue_alert_payload(
9292
if notification_uuid:
9393
group_params["notification_uuid"] = notification_uuid
9494
rule_workflow_context = {}
95-
if features.has("organizations:workflow-engine-ui-links", group.project.organization):
95+
if features.has("organizations:workflow-engine-ui", group.project.organization):
9696
workflow_urls = self._get_workflow_urls(group, rules)
9797
rule_workflow_context = {
9898
"Triggering Workflows": ", ".join([rule.label for rule in rules]),

src/sentry/integrations/slack/message_builder/issues.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ def build(self, notification_uuid: str | None = None) -> SlackBlock:
666666
rule_id = None
667667
rule_environment_id = None
668668
if self.rules:
669-
if features.has("organizations:workflow-engine-ui-links", self.group.organization):
669+
if features.has("organizations:workflow-engine-ui", self.group.organization):
670670
rule_id = int(get_key_from_rule_data(self.rules[0], "workflow_id"))
671671
elif should_fire_workflow_actions(self.group.organization, self.group.type):
672672
rule_id = int(get_key_from_rule_data(self.rules[0], "legacy_rule_id"))
@@ -680,7 +680,7 @@ def build(self, notification_uuid: str | None = None) -> SlackBlock:
680680
has_action = True
681681

682682
title_link = None
683-
if features.has("organizations:workflow-engine-ui-links", self.group.organization):
683+
if features.has("organizations:workflow-engine-ui", self.group.organization):
684684
title_link = get_title_link_workflow_engine_ui(
685685
self.group,
686686
self.event,

src/sentry/integrations/slack/message_builder/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def build_slack_footer(
1919
footer = f"{group.qualified_short_id}"
2020

2121
if rules:
22-
if features.has("organizations:workflow-engine-ui-links", group.organization):
22+
if features.has("organizations:workflow-engine-ui", group.organization):
2323
rule_url = absolute_uri(
2424
create_link_to_workflow(
2525
group.organization.id, get_key_from_rule_data(rules[0], "workflow_id")

src/sentry/notifications/notification_action/types.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,9 @@ def create_rule_instance_from_action(
196196
workflow_id = getattr(action, "workflow_id", None)
197197

198198
label = detector.name
199-
# We need to pass the legacy rule id when the workflow-engine-ui-links feature flag is disabled
199+
# We need to pass the legacy rule id when the workflow-engine-ui feature flag is disabled
200200
# This is so we can build the old link to the rule
201-
if not features.has(
202-
"organizations:workflow-engine-ui-links", detector.project.organization
203-
):
201+
if not features.has("organizations:workflow-engine-ui", detector.project.organization):
204202
if workflow_id is None:
205203
raise ValueError("Workflow ID is required when triggering an action")
206204

0 commit comments

Comments
 (0)