Adding conjoined-field-names for graphite templates
parent
bb9eed941e
commit
2822b89481
|
@ -237,6 +237,9 @@ func (t *template) Apply(line string) (string, map[string]string, string, error)
|
|||
return "", nil, "", fmt.Errorf("'field' can only be used once in each template: %q", line)
|
||||
}
|
||||
field = fields[i]
|
||||
} else if tag == "field*" {
|
||||
field = strings.Join(fields[i:], "_")
|
||||
break
|
||||
} else if tag == "measurement*" {
|
||||
measurement = append(measurement, fields[i:]...)
|
||||
break
|
||||
|
|
|
@ -100,6 +100,13 @@ func TestTemplateApply(t *testing.T) {
|
|||
measurement: "cpu.load",
|
||||
tags: map[string]string{"zone": "us-west"},
|
||||
},
|
||||
{
|
||||
test: "conjoined fields",
|
||||
input: "prod.us-west.server01.cpu.util.idle.percent",
|
||||
template: "env.zone.host.measurement.measurement.field*",
|
||||
measurement: "cpu.util",
|
||||
tags: map[string]string{"env": "prod", "zone": "us-west", "host": "server01"},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
|
Loading…
Reference in New Issue