Parse StatsD tags that contain colons
* Parse StatsD tags that contain colons
* Update parser.go
Use `SplitN` instead of `SplitAfterN` to simplify
@@ -37,12 +37,15 @@ func parseDogstatsdTags(s string) (string, map[string]string) {
s = s[:tagsIdx]
dims = make(map[string]string)
for _, t := range strings.Split(tagsRaw, ",") {
- parts := strings.Split(t, ":")
+ parts := strings.SplitN(t, ":", 2)
if len(parts) != 2 {
logger.Warnf("Invalid StatsD metric tag : %s", t)
continue
}
- dims[parts[0]] = parts[1]
+
+ k := parts[0]
+ v := parts[1]
+ dims[k] = v
}
}
return s, dims
