Skip to content

Commit

Permalink
statsd input plugin correctly handles colons in data-dog tag values n…
Browse files Browse the repository at this point in the history
…ow (#1794)

* Code correctly handles colons in tag values now

* Modified existing datadog tag test to include a tag value containing a colon
  • Loading branch information
rikaardhosein authored and jackzampolin committed Oct 7, 2016
1 parent 8aad9ce commit 4d37d81
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugins/inputs/statsd/statsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ func (s *Statsd) parseStatsdLine(line string) error {
tagstr := segment[1:]
tags := strings.Split(tagstr, ",")
for _, tag := range tags {
ts := strings.Split(tag, ":")
ts := strings.SplitN(tag, ":", 2)
var k, v string
switch len(ts) {
case 1:
Expand Down
3 changes: 2 additions & 1 deletion plugins/inputs/statsd/statsd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ func TestParse_DataDogTags(t *testing.T) {
s.ParseDataDogTags = true

lines := []string{
"my_counter:1|c|#host:localhost,environment:prod",
"my_counter:1|c|#host:localhost,environment:prod,endpoint:/:tenant?/oauth/ro",
"my_gauge:10.1|g|#live",
"my_set:1|s|#host:localhost",
"my_timer:3|ms|@0.1|#live,host:localhost",
Expand All @@ -703,6 +703,7 @@ func TestParse_DataDogTags(t *testing.T) {
"my_counter": map[string]string{
"host": "localhost",
"environment": "prod",
"endpoint": "/:tenant?/oauth/ro",
},

"my_gauge": map[string]string{
Expand Down

0 comments on commit 4d37d81

Please sign in to comment.