mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2025-01-24 05:08:11 +00:00
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"},
|
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",
|
name: "datadog tag extension with multiple colons",
|
||||||
in: "foo:100|c|@0.1|#tag1:foo:bar",
|
in: "foo:100|c|@0.1|#tag1:foo:bar",
|
||||||
|
|
|
@ -389,8 +389,8 @@ samples:
|
||||||
for _, component := range components[2:] {
|
for _, component := range components[2:] {
|
||||||
switch component[0] {
|
switch component[0] {
|
||||||
case '@':
|
case '@':
|
||||||
if statType != "c" && statType != "ms" {
|
if statType == "g" {
|
||||||
log.Debugln("Illegal sampling factor for non-counter metric on line", line)
|
log.Debugln("Illegal sampling factor for gauge metric type on line", line)
|
||||||
sampleErrors.WithLabelValues("illegal_sample_factor").Inc()
|
sampleErrors.WithLabelValues("illegal_sample_factor").Inc()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -405,7 +405,7 @@ samples:
|
||||||
|
|
||||||
if statType == "c" {
|
if statType == "c" {
|
||||||
value /= samplingFactor
|
value /= samplingFactor
|
||||||
} else if statType == "ms" {
|
} else if statType == "ms" || statType == "h" {
|
||||||
multiplyEvents = int(1 / samplingFactor)
|
multiplyEvents = int(1 / samplingFactor)
|
||||||
}
|
}
|
||||||
case '#':
|
case '#':
|
||||||
|
|
Loading…
Reference in a new issue