Metricstransform Processor
contrib, k8s
Maintainers: @dmitryax
Source: opentelemetry-collector-contrib
Supported Telemetry
Overview
Description
The metrics transform processor can be used to rename metrics, and add, rename or delete label keys and values. It can also be used to perform scaling and aggregations on metrics across labels or label values. The complete list of supported operations that can be applied to one or more metrics is provided in the below table. :information_source: This processor only supports renames/aggregations within a batch of metrics. It does not do any aggregation across batches, so it is not suitable for aggregating metrics from multiple sources (e.g. multiple nodes or clients).| Operation | Example (based on metric system.cpu.usage) |
|---|---|
| Rename metrics | Rename to system.cpu.usage_time |
| Add labels | Add new label identifier with value 1 to all points |
| Rename label keys | Rename label state to cpu_state |
| Rename label values | For label state, rename value idle to - |
| Delete data points | Delete all points where label state has value idle |
| Toggle data type | Change from int data points to double data points |
| Scale value | Multiply values by 1000 to convert from seconds to milliseconds |
| Aggregate across label sets | Retain only the label state, average all points with the same value for this label |
| Aggregate across label values | For label state, sum points where the value is user or system into used = user + system |
- Operations can be applied to one or more metrics using a
strictorregexpfilter - The
actionproperty allows metrics to be:- Updated in-place (
update) - Copied and updates applied to the copy (
insert) - Combined into a newly inserted metric that is generated by combining all data
points from the set of matching metrics into a single metric (
combine); the original matching metrics are also removed
- Updated in-place (
- When renaming metrics, capturing groups from the
regexpfilter will be expanded - When adding or updating a label value,
{{version}}will be replaced with this collectorโs version number
Configuration
Configuration is specified through a list of transformations and operations. Transformations and operations will be applied to all metrics in order so that later transformations or operations may reference the result of previous transformations or operations.Examples
Create a new metric from an existing metric
Create a new metric from an existing metric with matching label values
Create a new metric from an existing metric with matching label values with regexp
Rename metric
Rename multiple metrics using Substitution
Add a label
Add a label to multiple metrics
Rename labels
Rename labels for multiple metrics
Rename label values
Delete by label value
Toggle datatype
Scale value
Aggregate labels
sum aggregation function is supported for histogram and exponential histogram datatypes.
Aggregate label values
sum aggregation function is supported for histogram and exponential histogram datatypes.
Combine metrics
Group Metrics
Metric Transform Processor vs. Attributes Processor for Metrics
Regarding metric support, these two processors have overlapping functionality. They can both do simple modifications of metric attribute key-value pairs. As a general rule the attributes processor has more attribute related functionality, while the metrics transform processor can do much more data manipulation. The attributes processor is preferred when the only needed functionality is overlapping, as it natively uses the official OpenTelemetry data model. However, if the metric transform processor is already in use or its extra functionality is necessary, thereโs no need to migrate away from it. Shared functionality- Add attributes
- Update values of attributes
- delete
- hash
- extract
- Rename metrics
- Delete data points
- Toggle data type
- Scale value
- Aggregate across label sets
- Aggregate across label values
Last generated: 2026-04-13