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 Aliaksandr Valialkin
parent 218dfe7956
commit af5f967307
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -58,11 +58,14 @@ func insertRows(at *auth.Token, series []parser.Series, extraLabels []prompbmars
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"
}