forked from mirrors/statsd_exporter
Allow single-letter components in metric names
They are valid. Fixes #256. Signed-off-by: Matthias Rampke <matthias@prometheus.io>
This commit is contained in:
parent
bd5e04d6e3
commit
44ae8f557c
2 changed files with 24 additions and 1 deletions
|
@ -27,7 +27,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
statsdMetricRE = `[a-zA-Z_](-?[a-zA-Z0-9_])+`
|
statsdMetricRE = `[a-zA-Z_](-?[a-zA-Z0-9_])*`
|
||||||
templateReplaceRE = `(\$\{?\d+\}?)`
|
templateReplaceRE = `(\$\{?\d+\}?)`
|
||||||
|
|
||||||
metricLineRE = regexp.MustCompile(`^(\*\.|` + statsdMetricRE + `\.)+(\*|` + statsdMetricRE + `)$`)
|
metricLineRE = regexp.MustCompile(`^(\*\.|` + statsdMetricRE + `\.)+(\*|` + statsdMetricRE + `)$`)
|
||||||
|
|
|
@ -662,6 +662,29 @@ mappings:
|
||||||
`,
|
`,
|
||||||
configBad: true,
|
configBad: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
config: `---
|
||||||
|
mappings:
|
||||||
|
- match: p.*.*.c.*
|
||||||
|
match_type: glob
|
||||||
|
name: issue_256
|
||||||
|
labels:
|
||||||
|
one: $1
|
||||||
|
two: $2
|
||||||
|
three: $3
|
||||||
|
`,
|
||||||
|
mappings: mappings{
|
||||||
|
{
|
||||||
|
statsdMetric: "p.one.two.c.three",
|
||||||
|
name: "issue_256",
|
||||||
|
labels: map[string]string{
|
||||||
|
"one": "one",
|
||||||
|
"two": "two",
|
||||||
|
"three": "three",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
// Example from the README.
|
// Example from the README.
|
||||||
{
|
{
|
||||||
config: `
|
config: `
|
||||||
|
|
Loading…
Reference in a new issue