Skip to content

Commit

Permalink
convert periods in tag values to underscore (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenmh authored Sep 10, 2018
1 parent 4b10ad9 commit acc84a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const (
)

// illegalTagValueChars are loosely set to ensure we don't have statsd parse errors.
var illegalTagValueChars = regexp.MustCompile(`[:|]`)
var illegalTagValueChars = regexp.MustCompile(`[:|.]`)

type tagPair struct {
dimension string
Expand Down
8 changes: 8 additions & 0 deletions tags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@ func TestSerializeIllegalTags(t *testing.T) {
t.Errorf("Serialized output (%s) didn't match expected output", serialized)
}
}

func TestSerializeTagValuePeriod(t *testing.T) {
tags := map[string]string{"foo": "blah.blah", "q": "p"}
serialized := serializeTags(tags)
if serialized != ".__foo=blah_blah.__q=p" {
t.Errorf("Serialized output (%s) didn't match expected output", serialized)
}
}

0 comments on commit acc84a6

Please sign in to comment.