Set the alert condition and recovery
Your query returns a percentage. Tell Grafana when that percentage is too high, then add a recovery threshold so the alert doesn’t flap near the trigger point.
Set the threshold to 5 so the alert fires when the error rate goes above 5%. Then set recovery to 3 so it returns to normal only after the rate drops below 3%.
In the Alert condition section, leave Is above selected.
Set the threshold to
5.Click Preview alert rule condition to evaluate the threshold against your query.
Look for a result row above the button (for example Series 1 with a value). It may show Normal or Firing. With a threshold of 5, Normal is expected when the error rate is under 5% right now.
Still in Define query and alert condition, turn on Advanced options at the top of that section.
Scroll down to the Expressions area and open the C Threshold block. Under IS ABOVE, turn on Custom recovery threshold.
Still in C Threshold, in Stop alerting (or pending state) when below, set the value to 3.
The condition and recovery threshold are set. Next, you pick a folder and add labels so the alert is easy to find and organize.