fix(traefik): a router fails on 5xx only once it answered a few server errors (#5865)
CI / lint (push) Successful in 2s
CI / unit (push) Successful in 1m28s
CI / integration (push) Successful in 1m34s
CI / publish (push) Successful in 1m10s

One 502 among about 70 requests read steward@swarm critical at 1.4%:
past the 30-request minimum and far past the 0.1% cutoff, yet one
error. A new Settings → Thresholds field, "Fewest server errors to
fail" (traefik.threshold.min_5xx, default 3), must also be reached in
the 15-minute window; the 0.1% cutoff still catches a busy router.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 15:49:51 -04:00
co-authored by Claude Opus 5.5
parent c625528191
commit a24b9da69d
6 changed files with 35 additions and 4 deletions
+8
View File
@@ -74,6 +74,14 @@ def test_a_share_over_a_handful_of_requests_is_not_graded():
assert router_state(_window(e5=12.5, requests=30.0), TH, "")[0] == "crit"
def test_a_5xx_share_fails_only_once_enough_errors_were_answered():
# steward@swarm on 2026-10-15: one 502 among about 70 requests (#5865)
assert router_state(_window(e5=1.43, requests=70.0), TH, "") == ("ok", None)
assert router_state(_window(e5=4.29, requests=70.0), TH, "")[0] == "crit" # 3 errors
stricter = to_thresholds_cfg({"traefik.threshold.min_5xx": 1})
assert router_state(_window(e5=1.43, requests=70.0), stricter, "")[0] == "crit"
def test_grade_routers_hands_each_router_its_own_normals():
routers = [{"name": "errors@docker", "latest": _latest(e4=60.0)},
{"name": "app@docker", "latest": _latest(e4=60.0)}]