Skip to content

Commit

Permalink
Merge pull request #11 from sensu/feature/line-validation
Browse files Browse the repository at this point in the history
Validate number of Influx line segments
  • Loading branch information
portertech authored Dec 10, 2018
2 parents fb6e53d + 3bab92b commit c94a979
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 c94a979

Please sign in to comment.