mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-12-25 15:00:29 +00:00
Merge pull request #211 from claytono/add-distributions
Add support for Datadog distribution type
This commit is contained in:
commit
bee73cbb9e
3 changed files with 23 additions and 1 deletions
|
@ -224,6 +224,8 @@ mappings:
|
||||||
job: "${1}_server"
|
job: "${1}_server"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that timers will be accepted with the `ms`, `h`, and `d` statsd types. The first two are timers and histograms and the `d` type is for DataDog's "distribution" type. The distribution type is treated identically to timers and histograms.
|
||||||
|
|
||||||
### Regular expression matching
|
### Regular expression matching
|
||||||
|
|
||||||
Another capability when using YAML configuration is the ability to define matches
|
Another capability when using YAML configuration is the ability to define matches
|
||||||
|
|
|
@ -67,6 +67,26 @@ func TestHandlePacket(t *testing.T) {
|
||||||
labels: map[string]string{},
|
labels: map[string]string{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
name: "simple histogram",
|
||||||
|
in: "foo:200|h",
|
||||||
|
out: Events{
|
||||||
|
&TimerEvent{
|
||||||
|
metricName: "foo",
|
||||||
|
value: 200,
|
||||||
|
labels: map[string]string{},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
name: "simple distribution",
|
||||||
|
in: "foo:200|d",
|
||||||
|
out: Events{
|
||||||
|
&TimerEvent{
|
||||||
|
metricName: "foo",
|
||||||
|
value: 200,
|
||||||
|
labels: map[string]string{},
|
||||||
|
},
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
name: "datadog tag extension",
|
name: "datadog tag extension",
|
||||||
in: "foo:100|c|#tag1:bar,tag2:baz",
|
in: "foo:100|c|#tag1:bar,tag2:baz",
|
||||||
|
|
|
@ -575,7 +575,7 @@ func buildEvent(statType, metric string, value float64, relative bool, labels ma
|
||||||
relative: relative,
|
relative: relative,
|
||||||
labels: labels,
|
labels: labels,
|
||||||
}, nil
|
}, nil
|
||||||
case "ms", "h":
|
case "ms", "h", "d":
|
||||||
return &TimerEvent{
|
return &TimerEvent{
|
||||||
metricName: metric,
|
metricName: metric,
|
||||||
value: float64(value),
|
value: float64(value),
|
||||||
|
|
Loading…
Reference in a new issue