Skip to content

SCRUM-239 — Dashboard own metrics and unit tests

Plan ref: DSH-C12/E1 (docs/11-admin-plane-plan.md). Stacked on SCRUM-238.

What exists

Series (internal /metrics) Labels (closed sets, pre-initialised at 0)
dashboard_upstream_requests_total upstream ∈ prometheus, loki, config_audit, admin_auth_audit; result ∈ ok, error, timeout
dashboard_upstream_duration_seconds upstream
dashboard_cache_requests_total endpoint ∈ overview, series; result ∈ hit, miss, shared
dashboard_tail_streams gauge
dashboard_overview_degraded_total card

Reported through callback observers, so api, prometheus, loki, auditsrc and cache still import no metrics library. TESTING.md maps DSH-C1..C12 and H1 to tests; new fixture tests include a golden file of every PromQL template (internal/promql/testdata/templates.golden, regenerate with -update).

Also: prober target names (DASHBOARD_TARGETS) may contain hyphens, so the prober, Prometheus and Loki all call admin-auth admin-auth (SCRUM-230 labels by compose service name).

How to verify

cd services/dashboard
gofmt -l . && go vet ./... && go test -race -count=2 ./...
go test -cover -coverpkg=./... ./...

Results at time of writing

  • go test -race -count=2: pass; coverage across packages 83.3 %.
  • Metrics tests: a failing overview query counts its card; 10 concurrent overview requests → 1 miss + shared; an open tail sets the gauge to 1 and back to 0; an upstream timeout counts as timeout.

How it was built

DeepSeek run scoped (Landlock) to services/dashboard (412 s, ~61k output tokens, reasoning effort low); no bugs found. Claude added the target-name change (with tests) to unify service identity with SCRUM-230, and fixed stale "PHP Admin Auth" wording in the README.