diff --git a/pkg/mapper/mapper.go b/pkg/mapper/mapper.go index e44e581..248607a 100644 --- a/pkg/mapper/mapper.go +++ b/pkg/mapper/mapper.go @@ -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 + `)$`) diff --git a/pkg/mapper/mapper_test.go b/pkg/mapper/mapper_test.go index ca28897..30a98ed 100644 --- a/pkg/mapper/mapper_test.go +++ b/pkg/mapper/mapper_test.go @@ -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: `