mirror of
https://github.com/bloomberg/goldpinger.git
synced 2026-05-25 10:02:45 +00:00
DeletePeerUDPMetrics was missing cleanup for the two counters added in the previous commit (goldpinger_udp_duplicates_total and goldpinger_udp_out_of_order_total). Without this, rolled pods would leave stale counter label sets in /metrics. Add TestDeletePeerUDPMetrics_CleansAllPerPeerMetrics which populates every per-peer UDP metric, calls DeletePeerUDPMetrics, then verifies all label sets are removed. If a future per-peer metric is added to the perPeerCollectors map but not to DeletePeerUDPMetrics, the test fails with: "metric X still has 1 label set(s) after DeletePeerUDPMetrics — add it to the cleanup function" Verified the test catches regressions by temporarily removing one cleanup line — test correctly fails. Signed-off-by: Cooper Ry Lees <me@cooperlees.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>