Skip to content

Commit 53b78f5

Browse files
authored
chore(eap): Remove option to switch entities for EAP subscriptions (#96607)
We do not need this option anymore.
1 parent 63d0d0c commit 53b78f5

File tree

6 files changed

+415
-243
lines changed

6 files changed

+415
-243
lines changed

src/sentry/incidents/logic.py

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from django.utils import timezone as django_timezone
1717
from snuba_sdk import Column, Condition, Limit, Op
1818

19-
from sentry import analytics, audit_log, features, options, quotas
19+
from sentry import analytics, audit_log, features, quotas
2020
from sentry.api.exceptions import ResourceDoesNotExist
2121
from sentry.auth.access import SystemAccess
2222
from sentry.constants import CRASH_RATE_ALERT_AGGREGATE_ALIAS, ObjectStatus
@@ -165,7 +165,9 @@ def create_incident(
165165
# `bulk_create` doesn't send `post_save` signals, so we manually fire them here.
166166
for incident_project in incident_projects:
167167
post_save.send_robust(
168-
sender=type(incident_project), instance=incident_project, created=True
168+
sender=type(incident_project),
169+
instance=incident_project,
170+
created=True,
169171
)
170172

171173
create_incident_activity(
@@ -205,7 +207,10 @@ def update_incident_status(
205207
)
206208

207209
prev_status = incident.status
208-
kwargs: dict[str, Any] = {"status": status.value, "status_method": status_method.value}
210+
kwargs: dict[str, Any] = {
211+
"status": status.value,
212+
"status_method": status_method.value,
213+
}
209214
if status == IncidentStatus.CLOSED:
210215
kwargs["date_closed"] = date_closed if date_closed else django_timezone.now()
211216
elif status == IncidentStatus.OPEN:
@@ -414,11 +419,7 @@ def get_metric_issue_aggregates(
414419
)
415420

416421
except Exception:
417-
entity_key = (
418-
EntityKey.EAPItems
419-
if options.get("alerts.spans.use-eap-items")
420-
else EntityKey.EAPItemsSpan
421-
)
422+
entity_key = EntityKey.EAPItems
422423
metrics.incr(
423424
"incidents.get_incident_aggregates.snql.query.error",
424425
tags={
@@ -1051,7 +1052,9 @@ def update_detector(detector: Detector, enabled: bool) -> None:
10511052

10521053

10531054
def delete_alert_rule(
1054-
alert_rule: AlertRule, user: User | RpcUser | None = None, ip_address: str | None = None
1055+
alert_rule: AlertRule,
1056+
user: User | RpcUser | None = None,
1057+
ip_address: str | None = None,
10551058
) -> None:
10561059
"""
10571060
Marks an alert rule as deleted and fires off a task to actually delete it.
@@ -1223,7 +1226,9 @@ def _schedule_trigger_action(
12231226
)
12241227

12251228

1226-
def _sort_by_priority_list(triggers: Collection[AlertRuleTrigger]) -> list[AlertRuleTrigger]:
1229+
def _sort_by_priority_list(
1230+
triggers: Collection[AlertRuleTrigger],
1231+
) -> list[AlertRuleTrigger]:
12271232
priority_dict = {
12281233
WARNING_TRIGGER_LABEL: 0,
12291234
CRITICAL_TRIGGER_LABEL: 1,
@@ -1234,7 +1239,9 @@ def _sort_by_priority_list(triggers: Collection[AlertRuleTrigger]) -> list[Alert
12341239
)
12351240

12361241

1237-
def _prioritize_actions(triggers: Collection[AlertRuleTrigger]) -> list[AlertRuleTriggerAction]:
1242+
def _prioritize_actions(
1243+
triggers: Collection[AlertRuleTrigger],
1244+
) -> list[AlertRuleTriggerAction]:
12381245
"""
12391246
Function that given an input array of AlertRuleTriggers, prioritizes those triggers
12401247
based on their label, and then re-orders actions based on that ordering
@@ -1364,7 +1371,10 @@ def create_alert_rule_trigger_action(
13641371
target = AlertTarget(target_identifier, target_display)
13651372

13661373
# store priority in the json sentry_app_config
1367-
if priority is not None and type in [ActionService.PAGERDUTY, ActionService.OPSGENIE]:
1374+
if priority is not None and type in [
1375+
ActionService.PAGERDUTY,
1376+
ActionService.OPSGENIE,
1377+
]:
13681378
if sentry_app_config:
13691379
sentry_app_config.update({"priority": priority})
13701380
else:
@@ -1455,7 +1465,10 @@ def update_alert_rule_trigger_action(
14551465
updated_fields["target_identifier"] = target.identifier
14561466

14571467
# store priority in the json sentry_app_config
1458-
if priority is not None and type in [ActionService.PAGERDUTY, ActionService.OPSGENIE]:
1468+
if priority is not None and type in [
1469+
ActionService.PAGERDUTY,
1470+
ActionService.OPSGENIE,
1471+
]:
14591472
if updated_fields.get("sentry_app_config"):
14601473
updated_fields["sentry_app_config"].update({"priority": priority})
14611474
else:
@@ -1483,7 +1496,11 @@ def get_target_identifier_display_for_integration(
14831496
) -> AlertTarget:
14841497
if action_type == AlertRuleTriggerAction.Type.SLACK.value:
14851498
return _get_target_identifier_display_for_slack(
1486-
target_value, integration_id, use_async_lookup, input_channel_id, integrations
1499+
target_value,
1500+
integration_id,
1501+
use_async_lookup,
1502+
input_channel_id,
1503+
integrations,
14871504
)
14881505

14891506
if target_value is None:
@@ -1705,11 +1722,15 @@ def delete_alert_rule_trigger_action(trigger_action: AlertRuleTriggerAction) ->
17051722
trigger_action.update(status=ObjectStatus.PENDING_DELETION)
17061723

17071724

1708-
def get_actions_for_trigger(trigger: AlertRuleTrigger) -> QuerySet[AlertRuleTriggerAction]:
1725+
def get_actions_for_trigger(
1726+
trigger: AlertRuleTrigger,
1727+
) -> QuerySet[AlertRuleTriggerAction]:
17091728
return AlertRuleTriggerAction.objects.filter(alert_rule_trigger=trigger)
17101729

17111730

1712-
def get_available_action_integrations_for_org(organization: Organization) -> list[RpcIntegration]:
1731+
def get_available_action_integrations_for_org(
1732+
organization: Organization,
1733+
) -> list[RpcIntegration]:
17131734
"""
17141735
Returns a list of integrations that the organization has installed. Integrations are
17151736
filtered by the list of registered providers.
@@ -1878,7 +1899,10 @@ def check_aggregate_column_support(
18781899

18791900

18801901
def translate_aggregate_field(
1881-
aggregate: str, reverse: bool = False, allow_mri: bool = False, allow_eap: bool = False
1902+
aggregate: str,
1903+
reverse: bool = False,
1904+
allow_mri: bool = False,
1905+
allow_eap: bool = False,
18821906
) -> str:
18831907
column = get_column_from_aggregate(aggregate, allow_mri, allow_eap)
18841908
if not reverse:

0 commit comments

Comments
 (0)