Added newline to each metric line in wavefront output (#3290)
This commit is contained in:
parent
2a840cf3de
commit
ea11fae57b
|
@ -124,7 +124,7 @@ func (w *Wavefront) Write(metrics []telegraf.Metric) error {
|
||||||
for _, m := range metrics {
|
for _, m := range metrics {
|
||||||
for _, metricPoint := range buildMetrics(m, w) {
|
for _, metricPoint := range buildMetrics(m, w) {
|
||||||
metricLine := formatMetricPoint(metricPoint, w)
|
metricLine := formatMetricPoint(metricPoint, w)
|
||||||
//log.Printf("D! Output [wavefront] %s", metricLine)
|
log.Printf("D! Output [wavefront] %s", metricLine)
|
||||||
_, err := connection.Write([]byte(metricLine))
|
_, err := connection.Write([]byte(metricLine))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Wavefront: TCP writing error %s", err.Error())
|
return fmt.Errorf("Wavefront: TCP writing error %s", err.Error())
|
||||||
|
@ -262,6 +262,8 @@ func formatMetricPoint(metricPoint *MetricPoint, w *Wavefront) string {
|
||||||
buffer.WriteString("\"")
|
buffer.WriteString("\"")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buffer.WriteString("\n")
|
||||||
|
|
||||||
return buffer.String()
|
return buffer.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -275,7 +275,7 @@ func TestFormatMetricPoint(t *testing.T) {
|
||||||
Tags: map[string]string{"sp*c!@l\"-ch/rs": "sp*c!@l/ val\"ue"},
|
Tags: map[string]string{"sp*c!@l\"-ch/rs": "sp*c!@l/ val\"ue"},
|
||||||
}
|
}
|
||||||
|
|
||||||
expected := "test.metric.something 123.456000 1257894000 source=\"testSource\" sp-c--l--ch-rs=\"sp-c!@l/ val\\\"ue\""
|
expected := "test.metric.something 123.456000 1257894000 source=\"testSource\" sp-c--l--ch-rs=\"sp-c!@l/ val\\\"ue\"\n"
|
||||||
|
|
||||||
received := formatMetricPoint(testpoint, w)
|
received := formatMetricPoint(testpoint, w)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue