I poll the error rate right after deploy and print whether it crossed the threshold, showing the first step of automatic rollback.
def watch_error_rate(current, baseline, threshold):
return (current - baseline) > threshold
print("Monitoring and rollback")
print("After deploy v2: error rate 0.4%, baseline 0.3%, threshold 1%")
print("Error spike: %s" % watch_error_rate(0.4, 0.3, 1.0))
Before you run it, say out loud what it will print. Then open the answer.
What it prints
Monitoring and rollback
After deploy v2: error rate 0.4%, baseline 0.3%, threshold 1%
Error spike: False
A spike in error rate usually means a bad release. Catch it before users complain by watching the metric continuously, not once after the fact.