CompareTo
API reference for CompareTo
CompareTo
CompareTo
Comparison baseline types for alert rule thresholds.
Determines what the current metric value should be compared against when evaluating alert conditions.
TIME_PERIOD
Compare to a historical time period (relative comparison). Useful for detecting changes over time, seasonal patterns, etc. When using TIME_PERIOD, the compare_bin_delta parameter specifies how many time periods back to compare against.
RAW_VALUE
Compare to an absolute threshold value (absolute comparison). Useful for hard limits and business rule enforcement. When using RAW_VALUE, compare_bin_delta is ignored.
When using TIME_PERIOD, the allowed compare_bin_delta values depend on bin_size:
Example
CompareTo
CompareTo
Comparison baseline types for alert rule thresholds.
Determines what the current metric value should be compared against when evaluating alert conditions.
TIME_PERIOD
Compare to a historical time period (relative comparison). Useful for detecting changes over time, seasonal patterns, etc. When using TIME_PERIOD, the compare_bin_delta parameter specifies how many time periods back to compare against.
RAW_VALUE
Compare to an absolute threshold value (absolute comparison). Useful for hard limits and business rule enforcement. When using RAW_VALUE, compare_bin_delta is ignored.
When using TIME_PERIOD, the allowed compare_bin_delta values depend on bin_size:
Example
>>> # Compare current hourly drift to same hour yesterday (24 hours ago)
>>> alert_rule = AlertRule(
... compare_to=CompareTo.TIME_PERIOD,
... bin_size=BinSize.HOUR,
... compare_bin_delta=24 # 24 hours ago
... )
>>>
>>> # Compare daily metrics to last week (7 days ago)
>>> alert_rule = AlertRule(
... compare_to=CompareTo.TIME_PERIOD,
... bin_size=BinSize.DAY,
... compare_bin_delta=7 # 7 days ago
... )
>>>
>>> # Compare current accuracy to absolute minimum (no time comparison)
>>> alert_rule = AlertRule(
... compare_to=CompareTo.RAW_VALUE,
... threshold=0.85 # Must be above 85%
... )
#### TIME_PERIOD *= 'time_period'*
#### RAW_VALUE *= 'raw_value'*Last updated
Was this helpful?