You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Since DogStatsd supports dimensionality via tags on metric keys, this sink's approach is to splice the hostname out of the key in favor of a `host` tag
// The `host` tag is either forced here, or set downstream by the DogStatsd server
varlabels []metrics.Label
hostName:=s.hostName
// Splice the hostname out of the key
fori, el:=rangekey {
ifel==hostName {
key=append(key[:i], key[i+1:]...)
break
}
}
Reproduction Steps
Create a FanoutSink
Add a DogStatsdSink with a hostname
Add another Sink (e.g. InmemSink)
Call SetGaugeWithLabels() with the hostname as a value in the keys
Example of a test I added in datadog/dogstatsd_test.go :
Problem
go-metrics/datadog/dogstatsd.go
Lines 63 to 77 in 8586014
Reproduction Steps
SetGaugeWithLabels()
with the hostname as a value in the keysExample of a test I added in
datadog/dogstatsd_test.go
:Output
Expected Output
I would expect the key in the inmemsink to remain
consul.metric
but it is modified tometric.metric
Fix
The FanoutSink should ideally copy the key before passing it to sinks to avoid modifications
The text was updated successfully, but these errors were encountered: