Skip to content

Commit

Permalink
Don't add empty healthcheck tags to consul input (influxdata#5575)
Browse files Browse the repository at this point in the history
  • Loading branch information
glinton authored and bitcharmer committed Oct 18, 2019
1 parent a71cbfe commit 2f13b28
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions plugins/inputs/consul/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"strings"

"github.com/hashicorp/consul/api"

"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal/tls"
"github.com/influxdata/telegraf/plugins/inputs"
Expand Down Expand Up @@ -126,12 +127,12 @@ func (c *Consul) GatherHealthCheck(acc telegraf.Accumulator, checks []*api.Healt
for _, checkTag := range check.ServiceTags {
if c.TagDelimiter != "" {
splittedTag := strings.SplitN(checkTag, c.TagDelimiter, 2)
if len(splittedTag) == 1 {
if len(splittedTag) == 1 && checkTag != "" {
tags[checkTag] = checkTag
} else if len(splittedTag) == 2 {
} else if len(splittedTag) == 2 && splittedTag[1] != "" {
tags[splittedTag[0]] = splittedTag[1]
}
} else {
} else if checkTag != "" {
tags[checkTag] = checkTag
}
}
Expand Down

0 comments on commit 2f13b28

Please sign in to comment.