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
5 changes: 2 additions & 3 deletions src/sentry/api/endpoints/project_rules_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def get(self, request: Request, project: Project) -> Response:

available_ticket_actions = set()

project_has_filters = features.has("projects:alert-filters", project)
can_create_tickets = features.has(
"organizations:integrations-ticket-rules", project.organization
)
Expand All @@ -48,8 +47,8 @@ def get(self, request: Request, project: Project) -> Response:
# TODO: conditions need to be based on actions
for rule_type, rule_cls in rules:
node = rule_cls(project=project)
# skip over conditions if they are not in the migrated set for a project with alert-filters
if project_has_filters and node.id in MIGRATED_CONDITIONS:
# skip over conditions if they are not in the migrated set
if node.id in MIGRATED_CONDITIONS:
continue

if not can_create_tickets and node.id in TICKET_ACTIONS:
Expand Down
27 changes: 11 additions & 16 deletions src/sentry/api/serializers/rest_framework/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from rest_framework import serializers
from rest_framework.exceptions import ValidationError

from sentry import features
from sentry.api.fields.actor import OwnerActorField
from sentry.constants import MIGRATED_CONDITIONS, TICKET_ACTIONS
from sentry.models.environment import Environment
Expand Down Expand Up @@ -107,23 +106,19 @@ def validate(self, attrs):
}
)

# ensure that if a user has alert-filters enabled, they do not use old conditions
project = self.context["project"]
# ensure that we do not use old conditions
conditions = attrs.get("conditions", tuple())
project_has_filters = features.has("projects:alert-filters", project)
if project_has_filters:
old_conditions = [
condition for condition in conditions if condition["id"] in MIGRATED_CONDITIONS
]
if old_conditions:
raise serializers.ValidationError(
{
"conditions": "Conditions evaluating an event attribute, tag, or level are outdated please use an appropriate filter instead."
}
)
old_conditions = [
condition for condition in conditions if condition["id"] in MIGRATED_CONDITIONS
]
if old_conditions:
raise serializers.ValidationError(
{
"conditions": "Conditions evaluating an event attribute, tag, or level are outdated please use an appropriate filter instead."
}
)

# ensure that if a user has alert-filters enabled, they do not use a 'none' match on conditions
if project_has_filters and attrs.get("actionMatch") == "none":
if attrs.get("actionMatch") == "none":
raise serializers.ValidationError(
{
"conditions": "The 'none' match on conditions is outdated and no longer supported."
Expand Down
2 changes: 0 additions & 2 deletions src/sentry/features/temporary.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,6 @@ def register_temporary_features(manager: FeatureManager) -> None:
###########################
# Enables quick testing of disabling transaction name clustering for a project.
manager.add("projects:transaction-name-clustering-disabled", ProjectFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False, default=False)
# Adds additional filters and a new section to issue alert rules.
manager.add("projects:alert-filters", ProjectFeature, FeatureHandlerStrategy.INTERNAL, default=True)
manager.add("projects:discard-transaction", ProjectFeature, FeatureHandlerStrategy.INTERNAL, api_expose=False)
# Enable error upsampling
manager.add("projects:error-upsampling", ProjectFeature, FeatureHandlerStrategy.FLAGPOLE, default=False, api_expose=True)
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ class flags(TypedClassBitField):
# This Project has sent transactions
has_transactions: bool

# This Project has filters
# has_alert_filters is DEPRECATED
has_alert_filters: bool

# This Project has sessions
Expand Down
Loading