Skip to content

Commit 0d8b43c

Browse files
committed
chore(ACI): Add 1:1 metrics for dual processing
1 parent 4091ded commit 0d8b43c

File tree

2 files changed

+39
-8
lines changed

2 files changed

+39
-8
lines changed

src/sentry/incidents/subscription_processor.py

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -503,10 +503,21 @@ def process_update(self, subscription_update: QuerySubscriptionUpdate) -> None:
503503
if has_anomaly(
504504
potential_anomaly, trigger.label
505505
) and not self.check_trigger_matches_status(trigger, TriggerStatus.ACTIVE):
506-
metrics.incr(
507-
"incidents.alert_rules.threshold.alert",
508-
tags={"detection_type": self.alert_rule.detection_type},
509-
)
506+
if features.has(
507+
"organizations:workflow-engine-metric-alert-dual-processing-logs"
508+
):
509+
metrics.incr(
510+
"incidents.alert_rules.threshold.alert",
511+
tags={
512+
"detection_type": self.alert_rule.detection_type,
513+
"organization_id": self.alert_rule.organization_id,
514+
},
515+
)
516+
else:
517+
metrics.incr(
518+
"incidents.alert_rules.threshold.alert",
519+
tags={"detection_type": self.alert_rule.detection_type},
520+
)
510521
incident_trigger = self.trigger_alert_threshold(
511522
trigger, aggregation_value
512523
)
@@ -520,10 +531,21 @@ def process_update(self, subscription_update: QuerySubscriptionUpdate) -> None:
520531
and self.active_incident
521532
and self.check_trigger_matches_status(trigger, TriggerStatus.ACTIVE)
522533
):
523-
metrics.incr(
524-
"incidents.alert_rules.threshold.resolve",
525-
tags={"detection_type": self.alert_rule.detection_type},
526-
)
534+
if features.has(
535+
"organizations:workflow-engine-metric-alert-dual-processing-logs"
536+
):
537+
metrics.incr(
538+
"incidents.alert_rules.threshold.resolve",
539+
tags={
540+
"detection_type": self.alert_rule.detection_type,
541+
"organization_id": self.alert_rule.organization_id,
542+
},
543+
)
544+
else:
545+
metrics.incr(
546+
"incidents.alert_rules.threshold.resolve",
547+
tags={"detection_type": self.alert_rule.detection_type},
548+
)
527549
incident_trigger = self.trigger_resolve_threshold(
528550
trigger, aggregation_value
529551
)

src/sentry/workflow_engine/processors/workflow.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,5 +312,14 @@ def process_workflows(event_data: WorkflowEventData) -> set[Workflow]:
312312
"detector_type": detector.type,
313313
},
314314
)
315+
if features.has("organizations:workflow-engine-metric-alert-dual-processing-logs"):
316+
# in order to check if workflow engine is firing 1:1 with the old system, we must only count once rather than each action
317+
metrics.incr(
318+
"workflow_engine.process_workflows.fired_actions",
319+
tags={
320+
"detector_type": detector.type,
321+
"organization_id": detector.project.organization_id,
322+
},
323+
)
315324

316325
return triggered_workflows

0 commit comments

Comments
 (0)