Skip to content

SCRUM-264: dashboard overview 500 on NaN

The bug

GET /api/admin/dashboard/overview answered 500 overview_failed whenever a service had no requests in the last 5 minutes. histogram_quantile for the p95 card returns NaN over an empty window, and json.Marshal refuses non-finite floats, so the whole response failed. Seen on the team45 host after the 2026-09-27 redeploy: the Prometheus p95 query returned NaN for an idle service.

The fix

finite() in internal/api/overview.go turns NaN and ±Inf into nil (JSON null, "no data" on the card) for service cards and host values alike. The series endpoint already did this. The card is not marked degraded, because the query succeeded.

Tests

internal/api/overview_test.go:TestOverviewNonFiniteValuesAreNull: a NaN p95 for one service and +Inf memory ratio give 200, null for those two, other values intact, no degraded cards. Against the old code it fails with status = 500.

go vet ./... && go test -race -count=1 ./... in services/dashboard: pass.