From c81a95dd53d905b95c67568dd520db16ee1bdb8a Mon Sep 17 00:00:00 2001 From: Percy Wegmann Date: Wed, 8 Jan 2025 11:44:10 -0600 Subject: [PATCH] prober: clone histogram buckets before handing to Prometheus for derp_qd_probe_delays_seconds Updates tailscale/corp#25697 Signed-off-by: Percy Wegmann --- prober/derp.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/prober/derp.go b/prober/derp.go index 5adc0c0b4..3cd6394ad 100644 --- a/prober/derp.go +++ b/prober/derp.go @@ -15,6 +15,7 @@ import ( "fmt" "io" "log" + "maps" "net" "net/http" "net/netip" @@ -350,7 +351,7 @@ func (d *derpProber) probeQueuingDelay(from, to string, packetsPerSecond int, pa qdh.mx.Lock() result := []prometheus.Metric{ prometheus.MustNewConstMetric(prometheus.NewDesc("derp_qd_probe_dropped_packets", "Total packets dropped", nil, l), prometheus.CounterValue, float64(packetsDropped.Value())), - prometheus.MustNewConstHistogram(prometheus.NewDesc("derp_qd_probe_delays_seconds", "Distribution of queuing delays", nil, l), qdh.count, qdh.sum, qdh.bucketedCounts), + prometheus.MustNewConstHistogram(prometheus.NewDesc("derp_qd_probe_delays_seconds", "Distribution of queuing delays", nil, l), qdh.count, qdh.sum, maps.Clone(qdh.bucketedCounts)), } qdh.mx.Unlock() return result