graphite parser: apply tags from the Parser on the template

pull/4364/head
Cameron Sparr 2015-10-07 15:42:45 -06:00
parent 64cef0fa63
commit 73a630dfa6
1 changed files with 8 additions and 1 deletions

View File

@ -157,7 +157,14 @@ func (p *Parser) ApplyTemplate(line string) (string, map[string]string) {
}
// decode the name and tags
template := p.matcher.Match(fields[0])
return template.Apply(fields[0])
name, tags := template.Apply(fields[0])
// Set the default tags on the point if they are not already set
for k, v := range p.tags {
if _, ok := tags[k]; !ok {
tags[k] = v
}
}
return name, tags
}
// template represents a pattern and tags to map a graphite metric string to a influxdb Point