app/vminsert: allow to ingest datadog metrics with simpler tags - not enforcing key:value (#2839)

This commit is contained in:
Pedro Gonçalves 2022-07-07 00:18:00 +02:00 committed by GitHub
parent 7eb519b92e
commit d19e46de55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,11 +58,14 @@ func insertRows(series []parser.Series, extraLabels []prompbmarshal.Label) error
ctx.AddLabel("host", ss.Host)
for _, tag := range ss.Tags {
n := strings.IndexByte(tag, ':')
var name, value string
if n < 0 {
return fmt.Errorf("cannot find ':' in tag %q", tag)
name = tag
value = "no_label_value"
} else {
name = tag[:n]
value = tag[n+1:]
}
name := tag[:n]
value := tag[n+1:]
if name == "host" {
name = "exported_host"
}