Attributes Processor
core, contrib, k8s
Maintainers: @boostchicken
Source: opentelemetry-collector-contrib
Supported Telemetry
Overview
The attributes processor modifies attributes of a span, log, or metric. Please refer to config.go for the config spec. This processor also supports the ability to filter and match input data to determine if they should be included or excluded for specified actions. It takes a list of actions which are performed in order specified in the config. The supported actions are:insert: Inserts a new attribute in input data where the key does not already exist.update: Updates an attribute in input data where the key does exist.upsert: Performs insert or update. Inserts a new attribute in input data where the key does not already exist and updates an attribute in input data where the key does exist.delete: Deletes an attribute from the input data.hash: Hashes (SHA1) an existing attribute value.extract: Extracts values using a regular expression rule from the input key to target keys specified in the rule. If a target key already exists, it will be overridden. Note: It behaves similar to the Span Processorto_attributessetting with the existing attribute as the source.convert: Converts an existing attribute to a specified type.
insert, update and upsert,
keyis required- one of
value,from_attribute,from_context, ordefault_valueis required actionis required.
delete action,
keyand/orpatternis requiredaction: deleteis required.
hash action,
keyand/orpatternis requiredaction: hashis required.
extract action,
keyis requiredpatternis required.
convert action,
keyis requiredaction: convertis required.converted_typeis required and must be one of int, double or string
Default Values
Thedefault_value field can be used to specify a fallback value when the primary value source (e.g., attribute, or context value) is not available. This is useful for:
- Providing sensible defaults when attributes don’t exist
- Ensuring the pipeline doesn’t fail due to missing configuration
Attributes Processor for Metrics vs. Metric Transform Processor
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
Include/Exclude Filtering
The attribute processor exposes an option to provide a set of properties of a span, log or metric record to match against to determine if the input data should be included or excluded from the processor. To configure this option, underinclude and/or exclude at least match_type and
one of the following is required:
- For spans, one of
services,span_names,span_kinds,attributes,resourcesorlibrariesmust be specified with a non-empty value for a valid configuration. Thelog_bodies,log_severity_texts,log_severity_numberandmetric_namesfields are invalid. - For logs, one of
log_bodies,log_severity_texts,log_severity_number,attributes,resourcesorlibrariesmust be specified with a non-empty value for a valid configuration. Thespan_names,span_kinds,metric_namesandservicesfields are invalid. - For metrics, one of
metric_namesorresourcesmust be specified with a valid non-empty value for a valid configuration. Thespan_names,span_kinds,log_bodies,log_severity_texts,log_severity_number,services,attributesandlibrariesfields are invalid.
include and exclude are specified, the include properties
are checked before the exclude properties.
Match Configuration
Somematch_type values have additional configuration options that can be
specified. The match_type value is the name of the configuration section.
These sections are optional.
Warnings
In general, the Attributes processor is a very safe processor to use. Care only needs to be taken when modifying data point attributes:- Identity Conflict: Reducing/changing existing data point attributes has the potential to create an identity conflict since the Attributes processor does not perform any re-aggregation of the data points. Adding new attributes to data points is safe.
Configuration
Example Configuration
Last generated: 2026-10-05