Merge pull request #277 from xocasdashdash/updated-docs

Updated docs and added good/bad example yaml
This commit is contained in:
Matthias Rampke 2019-11-26 18:20:07 +01:00 committed by GitHub
commit 18a3c26447
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 0 deletions

View file

@ -198,6 +198,16 @@ mappings:
The metric name can also contain references to regex matches. The mapping above
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"

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 {