Skip to content

Commit

Permalink
actually make error_type = error ... make the error type be error
Browse files Browse the repository at this point in the history
  • Loading branch information
ceorourke committed Sep 20, 2024
1 parent 699798b commit 0c8ca4c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
3 changes: 3 additions & 0 deletions src/sentry/testutils/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,9 @@ def store_event(
normalized_data = manager.get_data()
event = None

if event_type == EventType.ERROR and normalized_data.get("type") == "default":
normalized_data["type"] = "error"

# When fingerprint is present on transaction, inject performance problems
if (
normalized_data.get("type") == "transaction"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def test_simple(self, mock_seer_request, mock_seer_store_request):
seasonality=AlertRuleSeasonality.AUTO,
detection_type=AlertRuleDetectionType.DYNAMIC,
)

self.login_as(self.user)

seer_return_value = {
Expand Down
12 changes: 1 addition & 11 deletions tests/sentry/seer/anomaly_detection/test_store_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from sentry.seer.anomaly_detection.utils import fetch_historical_data, format_historical_data
from sentry.snuba import errors, metrics_performance
from sentry.snuba.dataset import Dataset
from sentry.snuba.models import SnubaQuery, SnubaQueryEventType
from sentry.snuba.models import SnubaQuery
from sentry.testutils.cases import BaseMetricsTestCase, PerformanceIssueTestCase
from sentry.testutils.factories import EventType
from sentry.testutils.helpers.datetime import iso_format
Expand Down Expand Up @@ -88,11 +88,6 @@ def test_anomaly_detection_format_historical_data_two(self):
def test_anomaly_detection_fetch_historical_data(self):
alert_rule = self.create_alert_rule(organization=self.organization, projects=[self.project])
snuba_query = SnubaQuery.objects.get(id=alert_rule.snuba_query_id)
# CEO: despite passing event_type to store_event, the event type is default
# so we'll just update the type it's looking for to default
snuba_query_event_type = SnubaQueryEventType.objects.get(snuba_query=snuba_query)
snuba_query_event_type.type = SnubaQueryEventType.EventType.DEFAULT.value
snuba_query_event_type.save()

with self.options({"issues.group_attributes.send_kafka": True}):
self.store_event(
Expand Down Expand Up @@ -126,12 +121,7 @@ def test_anomaly_detection_fetch_historical_data_is_unresolved_query(self):
alert_rule = self.create_alert_rule(organization=self.organization, projects=[self.project])
snuba_query = SnubaQuery.objects.get(id=alert_rule.snuba_query_id)
snuba_query.query = "is:unresolved"
# CEO: despite passing event_type to store_event, the event type is default
# so we'll just update the type it's looking for to default
snuba_query_event_type = SnubaQueryEventType.objects.get(snuba_query=snuba_query)
snuba_query_event_type.type = SnubaQueryEventType.EventType.DEFAULT.value
snuba_query.save()
snuba_query_event_type.save()

with self.options({"issues.group_attributes.send_kafka": True}):
self.store_event(
Expand Down

0 comments on commit 0c8ca4c

Please sign in to comment.