Infrastructure
Azure Monitor: validate dynamic-threshold learning before falling back to a static alert
A production runbook for separating metric-series drift, aggregation, learning history, sensitivity and failing periods before waiting, repairing, using a static fallback or rolling back an Azure Monitor alert.
An API error-rate alert used to catch regressions, but it stays quiet after a deployment even while users receive failures. The metric exists and the action group works. The immediate fix is to replace the dynamic threshold with a static value low enough to page.
That change can restore a signal, but it can also hide the actual fault. The rule may be evaluating a different dimension series, averaging away short failures, waiting for enough learning history or requiring too many violating periods. A deployment may also have changed the metric’s normal regime so radically that the learned boundary no longer answers the original operational question.
The running case is an Azure Monitor metric alert on an API error rate. This runbook drives one explicit decision: wait for bounded learning, repair the rule, activate a temporary static fallback, or restore the last approved alert definition.
Freeze the alert contract
Export the deployed rule before changing it in the portal. Record the target scope, metric namespace and name, dimensions, aggregation, window size, evaluation frequency, operator, sensitivity, failing periods, ignoreDataBefore, actions and automatic resolution behavior.
RG="rg-observability-prod"
RULE="orders-api-error-rate-dynamic"
az monitor metrics alert show --resource-group "$RG" --name "$RULE" --output json > metric-alert-before.json
az monitor metrics alert show --resource-group "$RG" --name "$RULE" --query '{enabled:enabled,scopes:scopes,evaluationFrequency:evaluationFrequency,windowSize:windowSize,autoMitigate:autoMitigate,criteria:criteria,actions:actions}' --output yaml Also freeze a UTC incident window, the expected resource and dimension values, the last known-good alert, and the deployment that changed traffic or telemetry. A rule name is not a contract; the exact evaluated time series is.
signal: api server error rate
decision: page when one production region deviates materially
series:
resource: orders-api-prod
dimensions:
region: westeurope
aggregation:
type: Average
window: PT15M
frequency: PT5M
expected_behavior:
positive_test: sustained synthetic 5xx cohort
negative_test: isolated single error
fallback:
type: static_threshold
owner: platform-oncall
expiry: 2026-10-29T12:00:00Z
rollback: redeploy metric-alert-before.json Do not edit sensitivity, aggregation and failing periods together. Each changes a different part of the detection contract and makes the result difficult to attribute.
Prove the evaluated metric series
Start with the data Azure Monitor actually evaluates. Use the same resource, namespace, metric, dimension filters, aggregation and time grain as the rule. A portal chart left on Automatic is not a valid comparison with a five-minute average alert.
Check for four common forms of series drift:
- A deployment introduces a new resource ID, slot, revision or region value.
- A dimension changes spelling, casing or cardinality.
- The metric stops emitting zeros and becomes sparse when healthy.
- A percentage or rate is recomputed from a different denominator.
RESOURCE_ID="/subscriptions/<sub>/resourceGroups/rg-app-prod/providers/<type>/orders-api-prod"
START="2026-10-27T14:00:00Z"
END="2026-10-27T16:00:00Z"
az monitor metrics list --resource "$RESOURCE_ID" --metric "<metric-name>" --namespace "<metric-namespace>" --filter "region eq 'westeurope'" --aggregation Average --interval PT5M --start-time "$START" --end-time "$END" --output json > metric-series.json Adapt the namespace, metric and filter to the resource type. Compare the returned series with the dimensions in criteria.allOf. If the incident belongs to a series the rule no longer selects, changing threshold sensitivity will not restore coverage.
Separate learning readiness from a silent rule
Dynamic thresholds need history before they can alert. Azure Monitor does not trigger a newly learned series before it has at least three days and 30 samples. It uses recent history to establish hourly or daily patterns, and weekly seasonality needs about three weeks of data.
These are readiness boundaries, not a reason to wait indefinitely. Build a small evidence record per evaluated series.
Series first observed: 2026-10-24T11:20:00Z
Samples with the rule aggregation: 864
Stable hourly/daily regime: yes
Weekly history available: no
Recent outage inside learning history: yes
Recent deployment changed baseline: yes
Rule active long enough to evaluate: yes
Expected incident series selected: yes A new revision dimension can reset practical readiness even when the parent resource has months of history. Conversely, a mature series with enough data can still be silent because the aggregation, operator or violation policy filters the incident.
Use ignoreDataBefore only as an explicit model-boundary decision, for example after a permanent telemetry or traffic-regime change. Record why the earlier history is no longer comparable. Moving the date after every outage teaches the process to discard inconvenient evidence and creates another learning interval.
Reconstruct the detection logic
The dynamic boundary is only one layer. Azure Monitor first aggregates the metric into windows, compares each point with the learned boundary, then applies failingPeriods to decide whether enough evaluations violate.
{
"criterionType": "DynamicThresholdCriterion",
"metricName": "<metric-name>",
"operator": "GreaterThan",
"timeAggregation": "Average",
"alertSensitivity": "Medium",
"failingPeriods": {
"numberOfEvaluationPeriods": 4,
"minFailingPeriodsToAlert": 3
},
"ignoreDataBefore": "2026-10-17T00:00:00Z"
} This is an illustrative criterion, not a universal alert policy. Replay the incident as aggregated points. Count how many points actually crossed the boundary and whether they occurred within the evaluated periods. A sharp two-minute failure can disappear inside a 15-minute average. A 3-of-4 policy can correctly reject one isolated spike but also miss a short, severe customer impact.
Sensitivity controls how large a deviation must be relative to the learned pattern. It does not repair a wrong series or aggregation. Lowering the sensitivity setting to reduce noise, increasing the window and requiring more violations all widen the path to a page. Review them as separate controls.
Distinguish threshold, alert state and notification
A missing page does not prove that the dynamic threshold failed.
- If the metric never crosses the boundary, investigate series, model and aggregation.
- If the boundary is crossed but no alert instance opens, inspect failing periods, rule health and enabled state.
- If an alert instance opens but nobody is notified, inspect action groups and alert processing rules.
- If the alert is already active, remember that a stateful metric alert does not open a new instance for the same series until it resolves.
Use the fired-alert history and the rule’s “Why did this alert fire?” evidence with the metric chart aligned to the same aggregation and granularity. Keep evaluation evidence separate from delivery evidence.
Deploy a shadow rule before changing paging
Create a candidate as a non-paging shadow signal. Keep the same target series, then change one hypothesis only: aggregation, sensitivity, failing periods or model boundary. Give the candidate a distinct name, owner and expiry.
Run three controlled cases:
- A sustained positive test must cross the expected boundary and open one alert instance.
- A brief non-actionable spike must remain below the paging contract or resolve predictably.
- Recovery must close the stateful instance before the next positive test.
Compare production and shadow rules across several complete evaluation windows. Record the metric values, dynamic boundaries, violating points, alert state and notifications. Do not promote a rule merely because it fired once.
Use a static fallback without making it permanent
A static alert can be the right temporary control when a new series lacks learning history or a permanent regime change makes the old model unusable. Derive its threshold from an operational limit or a known-good baseline, not from a value chosen only to reproduce the current incident.
Keep the fallback as a separate rule with an owner, expiry, action group and explicit retirement condition. Do not silently convert the dynamic rule in place: parallel rules preserve comparison and make rollback unambiguous. Avoid double paging by routing the shadow rule to a non-paging channel until the cutover is approved.
The fallback is ready to retire when the dynamic series has sufficient history, controlled positive and negative tests behave as expected, and the learned boundary is compatible with the service’s operational limit.
Decide, validate or roll back
Wait only when the selected series is correct, the rule is healthy, minimum history is not yet available and a temporary signal covers the gap. Set a review time; “the model is learning” is not an open-ended incident state.
Repair the dynamic rule when evidence proves a wrong dimension, aggregation, operator or violation policy. Canary one change, then promote after a complete fire-and-resolve cycle.
Use the static fallback when business impact cannot remain uncovered during bounded learning. Keep the dynamic candidate in shadow mode and retire the fallback on evidence, not on age alone.
Roll back when the candidate misses the controlled positive test, pages on the negative test, selects the wrong series or fails to resolve. Restore the exact previous IaC revision or exported definition, verify scopes, criteria and actions, then replay one known signal. Rollback is complete only when detection and notification are both proven.
Conclusion
A silent dynamic-threshold alert is not solved by choosing a smaller number. First prove the metric series, aggregation, learning readiness, sensitivity, violating periods and alert lifecycle. Only then can the team tell whether the model needs time, the rule needs repair or production needs a temporary static guardrail.
The final state is explicit: bounded wait with coverage, canaried correction, expiring static fallback or restoration of the last approved rule. The objective is not to make the chart look sensitive; it is to recover a detection contract the on-call team can test and explain.