Skip to content

Commit 418df26

Browse files
wedamijaandrewshie-sentry
authored andcommitted
chore(crons): Move crons grouptype into monitors/grouptype.py (#97651)
We'll end up with circular imports as we work on this project if we leave these where they were. Also removing various deprecated and unused types <!-- Describe your PR here. -->
1 parent fa1e9a8 commit 418df26

File tree

12 files changed

+32
-40
lines changed

12 files changed

+32
-40
lines changed

src/sentry/issues/grouptype.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -606,36 +606,6 @@ class ProfileFunctionRegressionType(GroupType):
606606
notification_config = NotificationConfig(context=[NotificationContextField.APPROX_START_TIME])
607607

608608

609-
@dataclass(frozen=True)
610-
class MonitorIncidentType(GroupType):
611-
type_id = 4001
612-
slug = "monitor_check_in_failure"
613-
description = "Crons Monitor Failed"
614-
category = GroupCategory.CRON.value
615-
category_v2 = GroupCategory.OUTAGE.value
616-
released = True
617-
creation_quota = Quota(3600, 60, 60_000) # 60,000 per hour, sliding window of 60 seconds
618-
default_priority = PriorityLevel.HIGH
619-
notification_config = NotificationConfig(context=[])
620-
621-
622-
# XXX(epurkhiser): We renamed this group type but we keep the alias since we
623-
# store group type in pickles
624-
MonitorCheckInFailure = MonitorIncidentType
625-
626-
627-
@dataclass(frozen=True)
628-
class MonitorCheckInTimeout(MonitorIncidentType):
629-
# This is deprecated, only kept around for it's type_id
630-
type_id = 4002
631-
632-
633-
@dataclass(frozen=True)
634-
class MonitorCheckInMissed(MonitorIncidentType):
635-
# This is deprecated, only kept around for it's type_id
636-
type_id = 4003
637-
638-
639609
@dataclass(frozen=True)
640610
class ReplayRageClickType(ReplayGroupTypeDefaults, GroupType):
641611
type_id = 5002

src/sentry/monitors/grouptype.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from __future__ import annotations
2+
3+
from dataclasses import dataclass
4+
5+
from sentry_redis_tools.sliding_windows_rate_limiter import Quota
6+
7+
from sentry.issues.grouptype import GroupCategory, GroupType, NotificationConfig
8+
from sentry.types.group import PriorityLevel
9+
10+
11+
@dataclass(frozen=True)
12+
class MonitorIncidentType(GroupType):
13+
type_id = 4001
14+
slug = "monitor_check_in_failure"
15+
description = "Crons Monitor Failed"
16+
category = GroupCategory.CRON.value
17+
category_v2 = GroupCategory.OUTAGE.value
18+
released = True
19+
creation_quota = Quota(3600, 60, 60_000) # 60,000 per hour, sliding window of 60 seconds
20+
default_priority = PriorityLevel.HIGH
21+
notification_config = NotificationConfig(context=[])

src/sentry/monitors/logic/incident_occurrence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
from sentry import options
1818
from sentry.conf.types.kafka_definition import Topic, get_topic_codec
19-
from sentry.issues.grouptype import MonitorIncidentType
2019
from sentry.issues.issue_occurrence import IssueEvidence, IssueOccurrence
2120
from sentry.issues.producer import PayloadType, produce_occurrence_to_kafka
2221
from sentry.issues.status_change_message import StatusChangeMessage
2322
from sentry.models.group import GroupStatus
23+
from sentry.monitors.grouptype import MonitorIncidentType
2424
from sentry.monitors.models import (
2525
CheckInStatus,
2626
MonitorCheckIn,

src/sentry/monitors/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
from sentry import audit_log
1010
from sentry.api.serializers.rest_framework.rule import RuleSerializer
1111
from sentry.db.models import BoundedPositiveIntegerField
12-
from sentry.issues.grouptype import MonitorIncidentType
1312
from sentry.models.group import Group
1413
from sentry.models.project import Project
1514
from sentry.models.rule import Rule, RuleActivity, RuleActivityType, RuleSource
1615
from sentry.monitors.constants import DEFAULT_CHECKIN_MARGIN, MAX_TIMEOUT, TIMEOUT
16+
from sentry.monitors.grouptype import MonitorIncidentType
1717
from sentry.monitors.models import CheckInStatus, Monitor, MonitorCheckIn
1818
from sentry.monitors.types import DATA_SOURCE_CRON_MONITOR
1919
from sentry.projects.project_rules.creator import ProjectRuleCreator

tests/sentry/integrations/slack/notifications/test_issue_alert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
from sentry.integrations.models.organization_integration import OrganizationIntegration
1515
from sentry.integrations.slack.message_builder.issues import get_tags
1616
from sentry.integrations.types import ExternalProviders
17-
from sentry.issues.grouptype import MonitorIncidentType
1817
from sentry.issues.issue_occurrence import IssueEvidence, IssueOccurrence
1918
from sentry.issues.ownership.grammar import Matcher, Owner
2019
from sentry.issues.ownership.grammar import Rule as GrammarRule
2120
from sentry.issues.ownership.grammar import dump_schema
2221
from sentry.models.projectownership import ProjectOwnership
2322
from sentry.models.rule import Rule
23+
from sentry.monitors.grouptype import MonitorIncidentType
2424
from sentry.notifications.models.notificationsettingoption import NotificationSettingOption
2525
from sentry.notifications.models.notificationsettingprovider import NotificationSettingProvider
2626
from sentry.notifications.notifications.rules import AlertRuleNotification

tests/sentry/integrations/slack/test_message_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
from sentry.issues.grouptype import (
4141
FeedbackGroup,
4242
GroupCategory,
43-
MonitorIncidentType,
4443
PerformanceP95EndpointRegressionGroupType,
4544
ProfileFileIOGroupType,
4645
)
@@ -53,6 +52,7 @@
5352
from sentry.models.repository import Repository
5453
from sentry.models.rule import Rule as IssueAlertRule
5554
from sentry.models.team import Team
55+
from sentry.monitors.grouptype import MonitorIncidentType
5656
from sentry.notifications.utils.actions import MessageAction
5757
from sentry.seer.anomaly_detection.types import StoreDataResponse
5858
from sentry.seer.autofix.constants import SeerAutomationSource

tests/sentry/issues/test_ingest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
GroupCategory,
1818
GroupType,
1919
GroupTypeRegistry,
20-
MonitorIncidentType,
2120
NoiseConfig,
2221
)
2322
from sentry.issues.ingest import (
@@ -39,6 +38,7 @@
3938
from sentry.models.release import Release
4039
from sentry.models.releaseprojectenvironment import ReleaseProjectEnvironment
4140
from sentry.models.releases.release_project import ReleaseProject
41+
from sentry.monitors.grouptype import MonitorIncidentType
4242
from sentry.ratelimits.sliding_windows import RequestedQuota
4343
from sentry.receivers import create_default_projects
4444
from sentry.snuba.dataset import Dataset

tests/sentry/mail/test_adapter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from sentry.api.serializers.models.userreport import UserReportWithGroupSerializer
1919
from sentry.digests.notifications import build_digest, event_to_record
2020
from sentry.event_manager import EventManager, get_event_type
21-
from sentry.issues.grouptype import MonitorIncidentType
2221
from sentry.issues.issue_occurrence import IssueEvidence, IssueOccurrence
2322
from sentry.issues.ownership import grammar
2423
from sentry.issues.ownership.grammar import Matcher, Owner, dump_schema
@@ -34,6 +33,7 @@
3433
from sentry.models.repository import Repository
3534
from sentry.models.rule import Rule
3635
from sentry.models.userreport import UserReport
36+
from sentry.monitors.grouptype import MonitorIncidentType
3737
from sentry.notifications.models.notificationsettingoption import NotificationSettingOption
3838
from sentry.notifications.models.notificationsettingprovider import NotificationSettingProvider
3939
from sentry.notifications.notifications.rules import AlertRuleNotification

tests/sentry/monitors/logic/test_incident_occurrence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from django.utils import timezone
99
from sentry_kafka_schemas.schema_types.monitors_incident_occurrences_v1 import IncidentOccurrence
1010

11-
from sentry.issues.grouptype import MonitorIncidentType
11+
from sentry.monitors.grouptype import MonitorIncidentType
1212
from sentry.monitors.logic.incident_occurrence import (
1313
MONITORS_INCIDENT_OCCURRENCES,
1414
dispatch_incident_occurrence,

tests/sentry/monitors/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from django.db import IntegrityError
44

5-
from sentry.issues.grouptype import MonitorIncidentType
5+
from sentry.monitors.grouptype import MonitorIncidentType
66
from sentry.monitors.types import DATA_SOURCE_CRON_MONITOR
77
from sentry.monitors.utils import ensure_cron_detector, get_detector_for_monitor
88
from sentry.testutils.cases import TestCase

0 commit comments

Comments
 (0)