rename
DEPRECATED
This component is deprecated and will be removed in the next major version release. Please consider moving onto alternative components.
Rename metric paths as they are registered.
# Config fields, showing default valuesmetrics:rename:by_regexp: []child: {}
Metrics must be matched using dot notation even if the chosen output uses a different form. For example, the path would be 'foo.bar' rather than 'foo_bar' even when sending metrics to Prometheus. A full list of metrics paths that Benthos registers can be found in this list.
Fields​
by_regexp
​
A list of objects, each specifying an RE2 regular expression which will be tested against each metric path registered. Each occurrence of the expression will be replaced with the specified value. Inside the value $ signs are interpreted as submatch expansions, e.g. $1 represents the first submatch.
The field to_label
may contain any number of key/value pairs to be
added to a metric as labels, where the value may contain submatches from the
provided pattern. This allows you to extract (left-most) matched segments of the
renamed path into the label values.
Type: array
Default: []
# Examplesby_regexp:- pattern: foo\.([a-z]*)\.([a-z]*)to_label:bar: $2value: foo.$1
child
​
A child metric type, this is where renamed metrics will be routed.
Type: metrics
Default: {}
Examples​
In order to replace the paths 'foo.bar.0.zap' and 'foo.baz.1.zap' with 'zip.bar' and 'zip.baz' respectively, and store the respective values '0' and '1' under the label key 'index' we could use this config:
metrics:rename:by_regexp:- pattern: "foo\\.([a-z]*)\\.([a-z]*)\\.zap"value: "zip.$1"to_label:index: $2child:statsd:prefix: fooaddress: localhost:8125
These labels will only be injected into metrics registered without pre-existing
labels. Therefore it's currently not possible to combine labels registered from
the metric
processor with labels
set via renaming.
Debugging​
In order to see logs breaking down which metrics are registered and whether they are renamed enable logging at the TRACE level.