mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-14 19:31:11 +00:00
Fix matching empty statsd metric components
This commit is contained in:
parent
ff308119cf
commit
78de4b11db
2 changed files with 31 additions and 1 deletions
|
@ -97,7 +97,7 @@ func (m *metricMapper) initFromYAMLString(fileContents string) error {
|
|||
// Translate the glob-style metric match line into a proper regex that we
|
||||
// can use to match metrics later on.
|
||||
metricRe := strings.Replace(currentMapping.Match, ".", "\\.", -1)
|
||||
metricRe = strings.Replace(metricRe, "*", "([^.]+)", -1)
|
||||
metricRe = strings.Replace(metricRe, "*", "([^.]*)", -1)
|
||||
currentMapping.regex = regexp.MustCompile("^" + metricRe + "$")
|
||||
} else {
|
||||
currentMapping.regex = regexp.MustCompile(currentMapping.Match)
|
||||
|
|
|
@ -43,6 +43,21 @@ mappings:
|
|||
action: "$2"
|
||||
result: "$3"
|
||||
job: "test_dispatcher"
|
||||
- match: request_time.*.*.*.*.*.*.*.*.*.*.*.*
|
||||
labels:
|
||||
name: "tyk_http_request"
|
||||
method_and_path: "${1}"
|
||||
response_code: "${2}"
|
||||
apikey: "${3}"
|
||||
apiversion: "${4}"
|
||||
apiname: "${5}"
|
||||
apiid: "${6}"
|
||||
ipv4_t1: "${7}"
|
||||
ipv4_t2: "${8}"
|
||||
ipv4_t3: "${9}"
|
||||
ipv4_t4: "${10}"
|
||||
orgid: "${11}"
|
||||
oauthid: "${12}"
|
||||
- match: "*.*"
|
||||
labels:
|
||||
name: "catchall"
|
||||
|
@ -75,6 +90,21 @@ mappings:
|
|||
"result": "succeeded",
|
||||
"job": "test_dispatcher",
|
||||
},
|
||||
"request_time.get/threads/1/posts.200.00000000.nonversioned.discussions.a11bbcdf0ac64ec243658dc64b7100fb.172.20.0.1.12ba97b7eaa1a50001000001.": map[string]string{
|
||||
"name": "tyk_http_request",
|
||||
"method_and_path": "get/threads/1/posts",
|
||||
"response_code": "200",
|
||||
"apikey": "00000000",
|
||||
"apiversion": "nonversioned",
|
||||
"apiname": "discussions",
|
||||
"apiid": "a11bbcdf0ac64ec243658dc64b7100fb",
|
||||
"ipv4_t1": "172",
|
||||
"ipv4_t2": "20",
|
||||
"ipv4_t3": "0",
|
||||
"ipv4_t4": "1",
|
||||
"orgid": "12ba97b7eaa1a50001000001",
|
||||
"oauthid": "",
|
||||
},
|
||||
"foo.bar": map[string]string{
|
||||
"name": "catchall",
|
||||
"first": "foo",
|
||||
|
|
Loading…
Reference in a new issue