github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/metrics/rename.md (about) 1 --- 2 title: rename 3 type: metrics 4 status: deprecated 5 --- 6 7 <!-- 8 THIS FILE IS AUTOGENERATED! 9 10 To make changes please edit the contents of: 11 lib/metrics/rename.go 12 --> 13 14 import Tabs from '@theme/Tabs'; 15 import TabItem from '@theme/TabItem'; 16 17 :::warning DEPRECATED 18 This component is deprecated and will be removed in the next major version release. Please consider moving onto [alternative components](#alternatives). 19 ::: 20 21 Rename metric paths as they are registered. 22 23 ```yaml 24 # Config fields, showing default values 25 metrics: 26 rename: 27 by_regexp: [] 28 child: {} 29 ``` 30 31 Metrics must be matched using dot notation even if the chosen output uses a 32 different form. For example, the path would be 'foo.bar' rather than 'foo_bar' 33 even when sending metrics to Prometheus. A full list of metrics paths that 34 Benthos registers can be found in [this list](/docs/components/metrics/about#paths). 35 36 ## Fields 37 38 ### `by_regexp` 39 40 A list of objects, each specifying an RE2 regular expression which will be 41 tested against each metric path registered. Each occurrence of the expression 42 will be replaced with the specified value. Inside the value $ signs are 43 interpreted as submatch expansions, e.g. $1 represents the first submatch. 44 45 The field `to_label` may contain any number of key/value pairs to be 46 added to a metric as labels, where the value may contain submatches from the 47 provided pattern. This allows you to extract (left-most) matched segments of the 48 renamed path into the label values. 49 50 51 Type: `array` 52 Default: `[]` 53 54 ```yaml 55 # Examples 56 57 by_regexp: 58 - pattern: foo\.([a-z]*)\.([a-z]*) 59 to_label: 60 bar: $2 61 value: foo.$1 62 ``` 63 64 ### `child` 65 66 A child metric type, this is where renamed metrics will be routed. 67 68 69 Type: `metrics` 70 Default: `{}` 71 72 ## Examples 73 74 In order to replace the paths 'foo.bar.0.zap' and 'foo.baz.1.zap' with 'zip.bar' 75 and 'zip.baz' respectively, and store the respective values '0' and '1' under 76 the label key 'index' we could use this config: 77 78 ```yaml 79 metrics: 80 rename: 81 by_regexp: 82 - pattern: "foo\\.([a-z]*)\\.([a-z]*)\\.zap" 83 value: "zip.$1" 84 to_label: 85 index: $2 86 child: 87 statsd: 88 prefix: foo 89 address: localhost:8125 90 ``` 91 92 These labels will only be injected into metrics registered without pre-existing 93 labels. Therefore it's currently not possible to combine labels registered from 94 the [`metric` processor](/docs/components/processors/metric) with labels 95 set via renaming. 96 97 ## Debugging 98 99 In order to see logs breaking down which metrics are registered and whether they 100 are renamed enable logging at the TRACE level. 101