prober: clone histogram buckets before handing to Prometheus for derp_qd_probe_delays_seconds

Updates tailscale/corp#25697

Signed-off-by: Percy Wegmann <[email protected]>
This commit is contained in:
Percy Wegmann authored and Percy Wegmann committed 2025-01-08 12:02:12 -06:00
1 parent 8d4ca13cf8
commit c81a95dd53
1 file changed
+2 -1
+2 -1
View File
@@ -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