mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-26 01:01:01 +00:00
Fix mapping example in the README
Strings with leading asterisks need to be escaped in YAML. Add the same examples into the test suite to make sure they do what we claim they do. Fixes #102.
This commit is contained in:
parent
45d22f2add
commit
6c04ec1d89
2 changed files with 36 additions and 1 deletions
|
@ -107,7 +107,7 @@ mappings:
|
|||
action: "$2"
|
||||
outcome: "$3"
|
||||
job: "test_dispatcher"
|
||||
- match: *.signup.*.*
|
||||
- match: "*.signup.*.*"
|
||||
labels:
|
||||
name: "signup_events_total"
|
||||
provider: "$2"
|
||||
|
|
|
@ -265,6 +265,41 @@ mappings:
|
|||
`,
|
||||
configBad: true,
|
||||
},
|
||||
// Example from the README.
|
||||
{
|
||||
config: `
|
||||
mappings:
|
||||
- match: test.dispatcher.*.*.*
|
||||
labels:
|
||||
name: "dispatcher_events_total"
|
||||
processor: "$1"
|
||||
action: "$2"
|
||||
outcome: "$3"
|
||||
job: "test_dispatcher"
|
||||
- match: "*.signup.*.*"
|
||||
labels:
|
||||
name: "signup_events_total"
|
||||
provider: "$2"
|
||||
outcome: "$3"
|
||||
job: "${1}_server"
|
||||
`,
|
||||
mappings: map[string]map[string]string{
|
||||
"test.dispatcher.FooProcessor.send.success": map[string]string{
|
||||
"name": "dispatcher_events_total",
|
||||
"processor": "FooProcessor",
|
||||
"action": "send",
|
||||
"outcome": "success",
|
||||
"job": "test_dispatcher",
|
||||
},
|
||||
"foo_product.signup.facebook.failure": map[string]string{
|
||||
"name": "signup_events_total",
|
||||
"provider": "facebook",
|
||||
"outcome": "failure",
|
||||
"job": "foo_product_server",
|
||||
},
|
||||
"test.web-server.foo.bar": map[string]string{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
mapper := metricMapper{}
|
||||
|
|
Loading…
Reference in a new issue