Skip to content

Commit

Permalink
feat(crons): Add TickVolumeAnomolyResult
Browse files Browse the repository at this point in the history
This will be used to pass around the result of anomaly detection during
clock ticks.

Part of #79328
  • Loading branch information
evanpurkhiser committed Oct 24, 2024
1 parent 8a4dfe6 commit 2bab3d1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/sentry/monitors/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from dataclasses import dataclass
from datetime import datetime
from enum import StrEnum
from typing import Literal, NotRequired, TypedDict, Union

from django.utils.functional import cached_property
Expand Down Expand Up @@ -118,3 +119,23 @@ class IntervalSchedule:


ScheduleConfig = Union[CrontabSchedule, IntervalSchedule]


class TickVolumeAnomolyResult(StrEnum):
"""
This enum represents the result of comparing the minute we ticked past
with it's historic volume data. This is used to determine if we may have
consumed an anomalous number of check-ins, indicating there is an upstream
incident and we care not able to reliably report misses and time-outs.
A NORMAL result means we've considered the volume to be within the expected
volume for that minute. A ANOMALY value indicates there was a drop in
volume significant enough to consider it abnormal.
"""

NORMAL = "normal"
ABNORMAL = "abnormal"

@classmethod
def from_str(cls, st: str) -> TickVolumeAnomolyResult:
return cls[st.upper()]

0 comments on commit 2bab3d1

Please sign in to comment.