don't register metrics in loops

This commit is contained in:
Jay Wren
2025-11-19 13:25:25 -05:00
parent 8b32382cd9
commit f29e21b411
2 changed files with 14 additions and 5 deletions

View File

@@ -3,7 +3,6 @@ package nebula
import (
"net/netip"
"github.com/rcrowley/go-metrics"
"github.com/sirupsen/logrus"
"github.com/slackhq/nebula/firewall"
"github.com/slackhq/nebula/header"
@@ -146,7 +145,7 @@ func (f *Interface) consumeInsidePackets(packets [][]byte, sizes []int, count in
// Send all accumulated packets in one batch
if len(*batchPackets) > 0 {
batchSize := len(*batchPackets)
metrics.GetOrRegisterHistogram("batch.udp_write_size", nil, metrics.NewUniformSample(1024)).Update(int64(batchSize))
f.batchMetrics.udpWriteSize.Update(int64(batchSize))
n, err := f.writers[q].WriteMulti(*batchPackets, *batchAddrs)
if err != nil {