mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-14 11:21:17 +00:00
Merge pull request #277 from xocasdashdash/updated-docs
Updated docs and added good/bad example yaml
This commit is contained in:
commit
18a3c26447
2 changed files with 35 additions and 0 deletions
10
README.md
10
README.md
|
@ -200,6 +200,16 @@ could be written as:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
mappings:
|
mappings:
|
||||||
|
- match: "test\\.(\\w+)\\.(\\w+)\\.counter"
|
||||||
|
match_type: regex
|
||||||
|
name: "${2}_total"
|
||||||
|
labels:
|
||||||
|
provider: "$1"
|
||||||
|
```
|
||||||
|
|
||||||
|
Be aware about yaml escape rules as a mapping like the following one will not work.
|
||||||
|
```yaml
|
||||||
|
mappings:
|
||||||
- match: "test\.(\w+)\.(\w+)\.counter"
|
- match: "test\.(\w+)\.(\w+)\.counter"
|
||||||
match_type: regex
|
match_type: regex
|
||||||
name: "${2}_total"
|
name: "${2}_total"
|
||||||
|
|
|
@ -842,6 +842,31 @@ mappings:
|
||||||
configBad: true,
|
configBad: true,
|
||||||
expectedAction: ActionTypeDrop,
|
expectedAction: ActionTypeDrop,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// valid yaml example
|
||||||
|
config: `---
|
||||||
|
mappings:
|
||||||
|
- match: "test\\.(\\w+)\\.(\\w+)\\.counter"
|
||||||
|
match_type: regex
|
||||||
|
name: "${2}_total"
|
||||||
|
labels:
|
||||||
|
provider: "$1"
|
||||||
|
`,
|
||||||
|
configBad: false,
|
||||||
|
expectedAction: ActionTypeMap,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// invalid yaml example
|
||||||
|
config: `---
|
||||||
|
mappings:
|
||||||
|
- match: "test\.(\w+)\.(\w+)\.counter"
|
||||||
|
match_type: regex
|
||||||
|
name: "${2}_total"
|
||||||
|
labels:
|
||||||
|
provider: "$1"
|
||||||
|
`,
|
||||||
|
configBad: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, scenario := range scenarios {
|
for i, scenario := range scenarios {
|
||||||
|
|
Loading…
Reference in a new issue