From 903a1f8c902328177beeedaaff576e29dccb4eb2 Mon Sep 17 00:00:00 2001 From: Sean Porter Date: Mon, 10 Dec 2018 16:47:06 -0800 Subject: [PATCH] validate influx tags, the source of our woes Signed-off-by: Sean Porter --- main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index b84cdb0..efc2ae1 100644 --- a/main.go +++ b/main.go @@ -90,7 +90,10 @@ func CreateInfluxMetrics(samples model.Vector, metricPrefix string) string { for name, value := range sample.Metric { if name != "__name__" { - metric += fmt.Sprintf(",%s=%s", name, value) + tags := fmt.Sprintf(",%s=%s", name, value) + if !strings.Contains(tags, "\n") && strings.Count(tags, "=") == 1 { + metric += tags + } } } @@ -103,10 +106,7 @@ func CreateInfluxMetrics(samples model.Vector, metricPrefix string) string { metric += fmt.Sprintf(" value=%s %d\n", value, timestamp) - segments := strings.Split(metric, " ") - if len(segments) == 3 { - metrics += metric - } + metrics += metric } return metrics