Skip to content

Commit 16ce35d

Browse files
authored
Merge branch 'master' into stories/nm/urls
2 parents d49a174 + 6460092 commit 16ce35d

File tree

214 files changed

+495
-299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+495
-299
lines changed

migrations_lockfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ preprod: 0010_actual_drop_preprod_artifact_analysis_file_id_col
2727

2828
replays: 0006_add_bulk_delete_job
2929

30-
sentry: 0948_ds_waiver_org_fk_not_db_constr
30+
sentry: 0949_add_dashboard_widget_snapshot_model
3131

3232
social_auth: 0003_social_auth_json_field
3333

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@
264264
"diff-docs": "pnpm run install-api-docs && node --experimental-transform-types api-docs/openapi-diff.ts",
265265
"deref-api-docs": "node --experimental-transform-types api-docs/index.ts tests/apidocs/openapi-spectacular.json tests/apidocs/openapi-derefed.json",
266266
"build-chartcuterie-config": "node --experimental-transform-types config/build-chartcuterie.ts",
267-
"build-acceptance": "CODECOV_ENABLE_BA=false IS_ACCEPTANCE_TEST=1 NODE_ENV=production pnpm run build",
267+
"build-acceptance": "CODECOV_ENABLE_BA=false IS_ACCEPTANCE_TEST=1 STORYBOOK_TYPES=0 NODE_ENV=production pnpm run build",
268268
"build-production": "NODE_OPTIONS='--experimental-transform-types' NODE_ENV=production rspack --mode production --config ./rspack.config.ts",
269269
"build": "NODE_OPTIONS='--max-old-space-size=4096 --experimental-transform-types' rspack --config ./rspack.config.ts",
270270
"build-js-loader": "node --experimental-transform-types scripts/build-js-loader.ts",

src/sentry/digests/notifications.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ def unsplit_key(
6868
def event_to_record(
6969
event: Event, rules: Sequence[Rule], notification_uuid: str | None = None
7070
) -> Record:
71+
from sentry.notifications.notification_action.utils import should_fire_workflow_actions
72+
7173
if not rules:
7274
logger.warning("Creating record for %s that does not contain any rules!", event)
7375

@@ -77,7 +79,7 @@ def event_to_record(
7779
identifier_key = IdentifierKey.WORKFLOW
7880
for rule in rules:
7981
rule_ids.append(int(get_key_from_rule_data(rule, "workflow_id")))
80-
elif features.has("organizations:workflow-engine-trigger-actions", event.organization):
82+
elif should_fire_workflow_actions(event.organization):
8183
for rule in rules:
8284
rule_ids.append(int(get_key_from_rule_data(rule, "legacy_rule_id")))
8385
else:
@@ -166,6 +168,8 @@ def _build_digest_impl(
166168

167169

168170
def get_rules_from_workflows(project: Project, workflow_ids: set[int]) -> dict[int, Rule]:
171+
from sentry.notifications.notification_action.utils import should_fire_workflow_actions
172+
169173
rules: dict[int, Rule] = {}
170174
if not workflow_ids:
171175
return rules
@@ -219,14 +223,16 @@ def get_rules_from_workflows(project: Project, workflow_ids: set[int]) -> dict[i
219223

220224
assert rule.project_id == project.id, "Rule must belong to Project"
221225

222-
if features.has("organizations:workflow-engine-trigger-actions", project.organization):
226+
if should_fire_workflow_actions(project.organization):
223227
rule.data["actions"][0]["legacy_rule_id"] = rule.id
224228

225229
rules[workflow_id] = rule
226230
return rules
227231

228232

229233
def build_digest(project: Project, records: Sequence[Record]) -> DigestInfo:
234+
from sentry.notifications.notification_action.utils import should_fire_workflow_actions
235+
230236
if not records:
231237
return DigestInfo({}, {}, {})
232238

@@ -253,7 +259,7 @@ def build_digest(project: Project, records: Sequence[Record]) -> DigestInfo:
253259
group_ids = list(groups)
254260
rules = Rule.objects.in_bulk(rule_ids)
255261

256-
if features.has("organizations:workflow-engine-trigger-actions", project.organization):
262+
if should_fire_workflow_actions(project.organization):
257263
for rule in rules.values():
258264
rule.data["actions"][0]["legacy_rule_id"] = rule.id
259265

src/sentry/features/temporary.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,8 @@ def register_temporary_features(manager: FeatureManager):
430430
manager.add("organizations:trace-spans-format", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
431431
# Enable feature to use trace admin ui.
432432
manager.add("organizations:trace-view-admin-ui", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
433+
# Enable displaying span links in the attribute tree
434+
manager.add("organizations:trace-view-span-links", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
433435
# Enable feature to use trace tabs layout ui
434436
manager.add("organizations:trace-tabs-ui", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
435437
# Enable feature to load new traces onboarding guide.
@@ -495,6 +497,8 @@ def register_temporary_features(manager: FeatureManager):
495497
manager.add("organizations:workflow-engine-process-metric-issue-workflows", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
496498
# Enable workflow engine for issue alerts
497499
manager.add("organizations:workflow-engine-process-workflows", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
500+
# Enable single processing through workflow engine for issue alerts
501+
manager.add("organizations:workflow-engine-single-process-workflows", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
498502
# Enable logging to debug workflow engine process workflows
499503
manager.add("organizations:workflow-engine-process-workflows-logs", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
500504
# Enable firing actions for workflow engine issue alerts

src/sentry/incidents/action_handlers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,8 @@ def generate_incident_trigger_email_context(
503503
user: User | RpcUser | None = None,
504504
notification_uuid: str | None = None,
505505
):
506+
from sentry.notifications.notification_action.utils import should_fire_workflow_actions
507+
506508
snuba_query = metric_issue_context.snuba_query
507509
is_active = trigger_status == TriggerStatus.ACTIVE
508510
is_threshold_type_above = alert_context.threshold_type == AlertRuleThresholdType.ABOVE
@@ -579,7 +581,7 @@ def generate_incident_trigger_email_context(
579581
),
580582
query=urlencode(alert_link_params),
581583
)
582-
elif features.has("organizations:workflow-engine-trigger-actions", organization):
584+
elif should_fire_workflow_actions(organization):
583585
# lookup the incident_id from the open_period_identifier
584586
try:
585587
incident_group_open_period = IncidentGroupOpenPeriod.objects.get(

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from sentry.models.group import Group, GroupStatus
2323
from sentry.models.project import Project
2424
from sentry.models.rule import Rule
25+
from sentry.notifications.notification_action.utils import should_fire_workflow_actions
2526
from sentry.notifications.notifications.base import ProjectNotification
2627
from sentry.notifications.utils.rules import get_key_from_rule_data
2728

@@ -60,9 +61,7 @@ def build(self, notification_uuid: str | None = None) -> dict[str, object]:
6061
rule_environment_id = self.rules[0].environment_id
6162
if features.has("organizations:workflow-engine-ui-links", self.group.organization):
6263
rule_id = int(get_key_from_rule_data(self.rules[0], "workflow_id"))
63-
elif features.has(
64-
"organizations:workflow-engine-trigger-actions", self.group.organization
65-
):
64+
elif should_fire_workflow_actions(self.group.organization):
6665
rule_id = int(get_key_from_rule_data(self.rules[0], "legacy_rule_id"))
6766
else:
6867
rule_id = self.rules[0].id

src/sentry/integrations/messaging/message_builder.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from sentry.models.project import Project
1515
from sentry.models.rule import Rule
1616
from sentry.models.team import Team
17+
from sentry.notifications.notification_action.utils import should_fire_workflow_actions
1718
from sentry.notifications.notifications.base import BaseNotification
1819
from sentry.notifications.notifications.rules import AlertRuleNotification
1920
from sentry.notifications.utils.links import create_link_to_workflow
@@ -109,7 +110,7 @@ def get_rule_environment_param_from_rule(
109110
rule_id: int, rule_environment_id: int | None, organization: Organization
110111
) -> dict[str, str]:
111112
params = {}
112-
if features.has("organizations:workflow-engine-trigger-actions", organization):
113+
if should_fire_workflow_actions(organization):
113114
if (
114115
rule_environment_id is not None
115116
and (environment_name := fetch_environment_name(rule_environment_id)) is not None
@@ -269,7 +270,7 @@ def build_attachment_replay_link(
269270
def build_rule_url(rule: Any, group: Group, project: Project) -> str:
270271
org_slug = group.organization.slug
271272
project_slug = project.slug
272-
if features.has("organizations:workflow-engine-trigger-actions", group.organization):
273+
if should_fire_workflow_actions(group.organization):
273274
rule_id = get_key_from_rule_data(rule, "legacy_rule_id")
274275
rule_url = f"/organizations/{org_slug}/alerts/rules/{project_slug}/{rule_id}/details/"
275276
else:

src/sentry/integrations/metric_alerts.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ def incident_attachment_info(
194194
referrer: str = "metric_alert",
195195
notification_uuid: str | None = None,
196196
) -> AttachmentInfo:
197+
from sentry.notifications.notification_action.utils import should_fire_workflow_actions
198+
197199
status = get_status_text(metric_issue_context.new_status)
198200

199201
text = ""
@@ -220,7 +222,7 @@ def incident_attachment_info(
220222
if notification_uuid:
221223
title_link_params["notification_uuid"] = notification_uuid
222224

223-
if features.has("organizations:workflow-engine-trigger-actions", organization):
225+
if should_fire_workflow_actions(organization):
224226
try:
225227
alert_rule_id = AlertRuleDetector.objects.values_list("alert_rule_id", flat=True).get(
226228
detector_id=alert_context.action_identifier_id

src/sentry/integrations/opsgenie/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from sentry.integrations.services.integration.model import RpcIntegration
1212
from sentry.integrations.types import IntegrationProviderSlug
1313
from sentry.models.group import Group
14+
from sentry.notifications.notification_action.utils import should_fire_workflow_actions
1415
from sentry.notifications.utils.links import create_link_to_workflow
1516
from sentry.notifications.utils.rules import get_key_from_rule_data
1617
from sentry.shared_integrations.exceptions import ApiError
@@ -58,7 +59,7 @@ def _get_rule_urls(self, group, rules):
5859
rule_urls = []
5960
for rule in rules:
6061
rule_id = rule.id
61-
if features.has("organizations:workflow-engine-trigger-actions", organization):
62+
if should_fire_workflow_actions(organization):
6263
rule_id = get_key_from_rule_data(rule, "legacy_rule_id")
6364

6465
path = f"/organizations/{organization.slug}/alerts/rules/{group.project.slug}/{rule_id}/details/"

src/sentry/integrations/slack/actions/notification.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import sentry_sdk
1010
from slack_sdk.errors import SlackApiError
1111

12-
from sentry import features
1312
from sentry.api.serializers.rest_framework.rule import ACTION_UUID_KEY
1413
from sentry.constants import ISSUE_ALERTS_THREAD_DEFAULT
1514
from sentry.eventstore.models import GroupEvent
@@ -39,6 +38,7 @@
3938
from sentry.models.organization import Organization
4039
from sentry.models.rule import Rule
4140
from sentry.notifications.additional_attachment_manager import get_additional_attachment
41+
from sentry.notifications.notification_action.utils import should_fire_workflow_actions
4242
from sentry.notifications.utils.open_period import open_period_start_for_group
4343
from sentry.rules.actions import IntegrationEventAction
4444
from sentry.rules.base import CallbackFuture
@@ -479,7 +479,7 @@ def send_notification_noa(event: GroupEvent, futures: Sequence[RuleFuture]) -> N
479479
},
480480
skip_internal=False,
481481
)
482-
if features.has("organizations:workflow-engine-trigger-actions", self.project.organization):
482+
if should_fire_workflow_actions(self.project.organization):
483483
yield self.future(send_notification_noa, key=key)
484484
else:
485485
yield self.future(send_notification, key=key)

0 commit comments

Comments
 (0)