forked from mirrors/statsd_exporter
parent
8479e3d7a3
commit
028531e953
2 changed files with 13 additions and 3 deletions
|
@ -157,6 +157,16 @@ func TestHandlePacket(t *testing.T) {
|
|||
labels: map[string]string{"tag1": "bar", "tag2": "baz"},
|
||||
},
|
||||
},
|
||||
}, {
|
||||
name: "histogram with sampling",
|
||||
in: "foo:0.01|h|@0.1|#tag1:bar,#tag2:baz",
|
||||
out: Events{
|
||||
&TimerEvent{
|
||||
metricName: "foo",
|
||||
value: 0.01,
|
||||
labels: map[string]string{"tag1": "bar", "tag2": "baz"},
|
||||
},
|
||||
},
|
||||
}, {
|
||||
name: "datadog tag extension with multiple colons",
|
||||
in: "foo:100|c|@0.1|#tag1:foo:bar",
|
||||
|
|
|
@ -389,8 +389,8 @@ samples:
|
|||
for _, component := range components[2:] {
|
||||
switch component[0] {
|
||||
case '@':
|
||||
if statType != "c" && statType != "ms" {
|
||||
log.Debugln("Illegal sampling factor for non-counter metric on line", line)
|
||||
if statType == "g" {
|
||||
log.Debugln("Illegal sampling factor for gauge metric type on line", line)
|
||||
sampleErrors.WithLabelValues("illegal_sample_factor").Inc()
|
||||
continue
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ samples:
|
|||
|
||||
if statType == "c" {
|
||||
value /= samplingFactor
|
||||
} else if statType == "ms" {
|
||||
} else if statType == "ms" || statType == "h" {
|
||||
multiplyEvents = int(1 / samplingFactor)
|
||||
}
|
||||
case '#':
|
||||
|
|
Loading…
Reference in a new issue