mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-25 08:41:00 +00:00
Merge pull request #447 from pedro-stanaka/feat/doc-special-regex-match
Adding documentation about special regex match group
This commit is contained in:
commit
9115f0fa39
1 changed files with 21 additions and 0 deletions
21
README.md
21
README.md
|
@ -317,6 +317,27 @@ mappings:
|
|||
provider: "$1"
|
||||
```
|
||||
|
||||
#### Special match groups
|
||||
|
||||
When using regex, the match group `0` is the full match and can be used to attach labels to the metric.
|
||||
Example:
|
||||
|
||||
```yaml
|
||||
mappings:
|
||||
- match: ".+"
|
||||
match_type: regex
|
||||
name: "$0"
|
||||
labels:
|
||||
statsd_metric_name: "$0"
|
||||
```
|
||||
|
||||
If a metric `my.statsd_counter` is received, the metric name will **still** be mapped to `my_statsd_counter` (Prometheus compatible name).
|
||||
But the metric will also have the label `statsd_metric_name` with the value `my.statsd_counter` (unchanged value).
|
||||
|
||||
Note: If you use the `match` like the example (i.e. `.+`), be aware that it will be a "catch-all" block. So it should come at the very end of the mapping list.
|
||||
|
||||
The same is not achievable with glob matching, for more details check [this issue](https://github.com/prometheus/statsd_exporter/issues/444).
|
||||
|
||||
### Naming, labels, and help
|
||||
|
||||
Please note that metrics with the same name must also have the same set of
|
||||
|
|
Loading…
Reference in a new issue