mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2025-06-07 19:58:48 +00:00
Add examples for quoting matches that start with *
.
The YAML parser chokes on strings starting with asterisks. Add a scenario to the spec that shows this, and that shows that quoting fixes the issue.
This commit is contained in:
parent
e24888356f
commit
45d22f2add
1 changed files with 26 additions and 1 deletions
|
@ -203,6 +203,31 @@ mappings:
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// Config with an improperly escaped *.
|
||||||
|
{
|
||||||
|
config: `
|
||||||
|
mappings:
|
||||||
|
- match: *.test.*
|
||||||
|
labels:
|
||||||
|
name: "name"
|
||||||
|
label: "${1}_foo"`,
|
||||||
|
configBad: true,
|
||||||
|
},
|
||||||
|
// Config with a properly escaped *.
|
||||||
|
{
|
||||||
|
config: `
|
||||||
|
mappings:
|
||||||
|
- match: "*.test.*"
|
||||||
|
labels:
|
||||||
|
name: "name"
|
||||||
|
label: "${2}_foo"`,
|
||||||
|
mappings: map[string]map[string]string{
|
||||||
|
"foo.test.a": map[string]string{
|
||||||
|
"name": "name",
|
||||||
|
"label": "a_foo",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
// Config with good timer type.
|
// Config with good timer type.
|
||||||
{
|
{
|
||||||
config: `---
|
config: `---
|
||||||
|
@ -233,7 +258,7 @@ mappings:
|
||||||
{
|
{
|
||||||
config: `---
|
config: `---
|
||||||
mappings:
|
mappings:
|
||||||
- match: *\.foo
|
- match: "*\.foo"
|
||||||
match_type: regex
|
match_type: regex
|
||||||
labels:
|
labels:
|
||||||
name: "foo"
|
name: "foo"
|
||||||
|
|
Loading…
Reference in a new issue