Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,6 @@ module = [
"tests.sentry.flags.*",
"tests.sentry.grouping.*",
"tests.sentry.hybridcloud.*",
"tests.sentry.incidents.action_handlers.*",
"tests.sentry.incidents.handlers.*",
"tests.sentry.incidents.serializers.*",
"tests.sentry.insights.*",
Expand Down
6 changes: 3 additions & 3 deletions src/sentry/features/temporary.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ def register_temporary_features(manager: FeatureManager) -> None:
# Enable dual writing for issue alert issues (see: alerts create issues)
manager.add("organizations:workflow-engine-issue-alert-dual-write", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
# Enable workflow processing for metric issues
manager.add("organizations:workflow-engine-process-metric-issue-workflows", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
manager.add("organizations:workflow-engine-process-metric-issue-workflows", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False, default=True)
# Enable single processing through workflow engine for issue alerts
manager.add("organizations:workflow-engine-single-process-workflows", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
# Enable logging to debug workflow engine process workflows
Expand All @@ -529,7 +529,7 @@ def register_temporary_features(manager: FeatureManager) -> None:
# Enable logs to debug metric alert dual processing
manager.add("organizations:workflow-engine-metric-alert-dual-processing-logs", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
# Enable Processing for Metric Alerts in the workflow_engine
manager.add("organizations:workflow-engine-metric-alert-processing", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
manager.add("organizations:workflow-engine-metric-alert-processing", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False, default=True)
# Enable Creation of Metric Alerts that use the `group_by` field in the workflow_engine
manager.add("organizations:workflow-engine-metric-alert-group-by-creation", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
# Enable ingestion through trusted relays only
Expand All @@ -541,7 +541,7 @@ def register_temporary_features(manager: FeatureManager) -> None:
# Use workflow engine serializers to return data for old rule / incident endpoints
manager.add("organizations:workflow-engine-rule-serializers", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
# Enable single processing of metric issues
manager.add("organizations:workflow-engine-single-process-metric-issues", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
manager.add("organizations:workflow-engine-single-process-metric-issues", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False, default=True)
# Enable metric detector limits by plan type
manager.add("organizations:workflow-engine-metric-detector-limit", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
# Enable EventUniqueUserFrequencyConditionWithConditions special alert condition
Expand Down
18 changes: 7 additions & 11 deletions src/sentry/incidents/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,13 @@ def fetch_metric_issue_open_periods(
user: User | RpcUser | None = None,
) -> list[Any]:
try:
if features.has(
"organizations:workflow-engine-single-process-metric-issues",
organization, # Metric issue single processing
):
# temporarily fetch the alert rule ID from the detector ID
alert_rule_detector = AlertRuleDetector.objects.filter(
detector_id=open_period_identifier, alert_rule_id__isnull=False
).first()
if alert_rule_detector is not None:
# open_period_identifier is a metric detector ID -> get the alert rule ID
open_period_identifier = alert_rule_detector.alert_rule_id
# temporarily fetch the alert rule ID from the detector ID
alert_rule_detector = AlertRuleDetector.objects.filter(
detector_id=open_period_identifier, alert_rule_id__isnull=False
).first()
if alert_rule_detector is not None:
# open_period_identifier is a metric detector ID -> get the alert rule ID
open_period_identifier = alert_rule_detector.alert_rule_id
Comment on lines +138 to +144
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way we could update this to no longer rely on the AlertRuleDetector table (or the alert_rule_id?) as we're removing these processing flags, my hope is that as we remove the feature flags we're left with the desired end state implementation.

if we have to have the alert_rule_id for like charting things, then it'd help to have that listed out somewhere as they'll be important blockers to fix before we can cleanup too much code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is coming in my next PR 😅 doing a refactor so the charts use the open period serializer instead.


resp = client.get(
auth=ApiKey(organization_id=organization.id, scope_list=["org:read"]),
Expand Down
6 changes: 2 additions & 4 deletions src/sentry/issues/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django.conf import settings
from django.db import router, transaction

from sentry import eventstream, features
from sentry import eventstream
from sentry.constants import LOG_LEVELS_MAP, MAX_CULPRIT_LENGTH
from sentry.event_manager import (
GroupInfo,
Expand Down Expand Up @@ -74,9 +74,7 @@ def save_issue_occurrence(
_get_or_create_group_release(environment, release, event, [group_info])

# Create IncidentGroupOpenPeriod relationship for metric issues
if occurrence.type == MetricIssue and features.has(
"organizations:workflow-engine-single-process-metric-issues", event.organization
):
if occurrence.type == MetricIssue:
open_period = get_latest_open_period(group_info.group)
if open_period:
IncidentGroupOpenPeriod.create_from_occurrence(
Expand Down
7 changes: 0 additions & 7 deletions src/sentry/notifications/notification_action/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,13 +486,6 @@ def invoke_legacy_registry(
if isinstance(event, GroupEvent):
evidence_data, priority = cls._extract_from_group_event(event)
elif isinstance(event, Activity):
# we only want to fire resolution activities if we are single processing
if not features.has(
"organizations:workflow-engine-single-process-metric-issues",
event_data.group.organization,
):
return

evidence_data, priority = cls._extract_from_activity(event)
else:
raise ValueError(
Expand Down
8 changes: 1 addition & 7 deletions src/sentry/notifications/notification_action/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@ def should_fire_workflow_actions(org: Organization, type_id: int) -> bool:
in rollout_type_ids # While we are rolling out these groups & we are single processing
and features.has("organizations:workflow-engine-single-process-workflows", org)
)
or (
type_id == MetricIssue.type_id
and features.has(
"organizations:workflow-engine-single-process-metric-issues",
org, # Metric issue single processing
)
)
or (type_id == MetricIssue.type_id)
or features.has(
"organizations:workflow-engine-trigger-actions",
org, # Other action testing
Expand Down
7 changes: 0 additions & 7 deletions src/sentry/tasks/post_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,13 +1046,6 @@ def process_workflow_engine_metric_issues(job: PostProcessJob) -> None:
if job["is_reprocessed"]:
return

org = job["event"].project.organization
if not (
features.has("organizations:workflow-engine-process-metric-issue-workflows", org)
or features.has("organizations:workflow-engine-single-process-metric-issues", org)
):
return

process_workflow_engine(job)


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging

from sentry import features
from sentry.issues.status_change_consumer import group_status_update_registry
from sentry.issues.status_change_message import StatusChangeMessageData
from sentry.models.activity import Activity
Expand Down Expand Up @@ -43,26 +42,8 @@ def workflow_status_update_handler(
metrics.incr("workflow_engine.tasks.error.no_detector_id")
return

# We should only fire actions for activity updates if we should be firing actions
# if dual proccessing or single proccessing is enabled
if features.has( # Metric issue single processing
"organizations:workflow-engine-single-process-metric-issues",
group.organization,
) or features.has( # Metric dual processing
"organizations:workflow-engine-metric-alert-processing",
group.organization,
):
process_workflow_activity.delay(
activity_id=activity.id,
group_id=group.id,
detector_id=detector_id,
)
else:
logger.info(
"workflow_engine.tasks.process_workflows.activity_update.skipped",
extra={
"activity_id": activity.id,
"group_id": group.id,
"detector_id": detector_id,
},
)
process_workflow_activity.delay(
activity_id=activity.id,
group_id=group.id,
detector_id=detector_id,
)
11 changes: 0 additions & 11 deletions src/sentry/workflow_engine/models/incident_groupopenperiod.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from django.db import IntegrityError, models
from django.db.models import Q

from sentry import features
from sentry.backup.scopes import RelocationScope
from sentry.db.models import (
BoundedBigIntegerField,
Expand Down Expand Up @@ -240,11 +239,6 @@ def update_incident_activity_based_on_group_activity(
logger.warning("No open period found for group", extra={"group_id": group.id})
return

if not features.has(
"organizations:workflow-engine-single-process-metric-issues", group.project.organization
):
return

# get the incident for the open period
try:
incident_id = IncidentGroupOpenPeriod.objects.get(group_open_period=open_period).incident_id
Expand Down Expand Up @@ -293,11 +287,6 @@ def update_incident_based_on_open_period_status_change(
logger.warning("No open period found for group", extra={"group_id": group.id})
return

if not features.has(
"organizations:workflow-engine-single-process-metric-issues", group.project.organization
):
return

# get the incident for the open period
try:
incident_id = IncidentGroupOpenPeriod.objects.get(group_open_period=open_period).incident_id
Expand Down
32 changes: 0 additions & 32 deletions tests/sentry/incidents/action_handlers/__init__.py

This file was deleted.

Loading
Loading