Skip to content

Commit

Permalink
validate number of influx line segments
Browse files Browse the repository at this point in the history
same validation logic used by the sensu go agent for metric extraction

Signed-off-by: Sean Porter <portertech@gmail.com>
  • Loading branch information
portertech committed Dec 10, 2018
1 parent fb6e53d commit 3bab92b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sensu-prometheus-collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"os"
"strconv"
"strings"
"time"

"github.com/kelseyhightower/envconfig"
Expand Down Expand Up @@ -100,7 +101,10 @@ func CreateInfluxMetrics(samples model.Vector, metricPrefix string) string {

metric += fmt.Sprintf(" value=%s %d\n", value, timestamp)

metrics += metric
segments := strings.Split(metric, " ")
if len(segments) == 3 {
metrics += metric
}
}

return metrics
Expand Down

0 comments on commit 3bab92b

Please sign in to comment.