Updated docs and added good/bad example yaml

Signed-off-by: Joaquin Fernandez Campo <jfcampo@gmail.com>
This commit is contained in:
Joaquín Fernández Campo 2019-11-26 09:56:14 +01:00 committed by Joaquin Fernandez Campo
parent 7d2a901b6c
commit 84657e85ec
3 changed files with 36 additions and 0 deletions

View file

@ -1,5 +1,6 @@
## unreleased / ????-??-??
* [ENHANCEMENT] Updated readme docs and added a test for invalid yaml ([#274](https://github.com/prometheus/statsd_exporter/issues/274))
* [ENHANCEMENT] Support sampling factors for all statsd metric types ([#264](https://github.com/prometheus/statsd_exporter/issues/250))
* [ENHANCEMENT] Support Librato and InfluxDB labeling formats ([#267](https://github.com/prometheus/statsd_exporter/pull/267))

View file

@ -200,6 +200,16 @@ could be written as:
```yaml
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_type: regex
name: "${2}_total"

View file

@ -842,6 +842,31 @@ mappings:
configBad: true,
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 {