Skip to content

Commit bf16c76

Browse files
committed
Assign correct metric types when sending metrics with datadog output
1 parent 784ac6c commit bf16c76

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

plugins/outputs/datadog/datadog.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type Metric struct {
4343
Points [1]Point `json:"points"`
4444
Host string `json:"host"`
4545
Tags []string `json:"tags,omitempty"`
46+
Type string `json:"type"`
4647
}
4748

4849
type Point [2]float64
@@ -91,6 +92,13 @@ func (d *Datadog) Write(metrics []telegraf.Metric) error {
9192
Tags: metricTags,
9293
Host: host,
9394
}
95+
switch m.Type() {
96+
case telegraf.Counter, telegraf.Histogram:
97+
metric.Type = "count"
98+
case telegraf.Gauge:
99+
metric.Type = "gauge"
100+
}
101+
94102
metric.Points[0] = dogM
95103
tempSeries = append(tempSeries, metric)
96104
metricCounter++

0 commit comments

Comments
 (0)