Merge pull request #309 from prometheus/mr/issue-256

Allow single-letter components in metric names
This commit is contained in:
Matthias Rampke 2020-06-19 14:15:01 +02:00 committed by GitHub
commit ed37775e02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View file

@ -27,7 +27,7 @@ import (
)
var (
statsdMetricRE = `[a-zA-Z_](-?[a-zA-Z0-9_])+`
statsdMetricRE = `[a-zA-Z_](-?[a-zA-Z0-9_])*`
templateReplaceRE = `(\$\{?\d+\}?)`
metricLineRE = regexp.MustCompile(`^(\*\.|` + statsdMetricRE + `\.)+(\*|` + statsdMetricRE + `)$`)

View file

@ -742,6 +742,29 @@ mappings:
`,
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.
{
config: `