Chapter 3. Processors
Processors process the data between it is received and exported. Processors are optional. By default, no processors are enabled. Processors must be enabled for every data source. Not all processors support all data sources. Depending on the data source, multiple processors might be enabled. Note that the order of processors matters.
Currently, the following General Availability and Technology Preview processors are available for the Red Hat build of OpenTelemetry:
3.1. Batch Processor Copy linkLink copied to clipboard!
The Batch Processor batches traces and metrics to reduce the number of outgoing connections needed to transfer the telemetry information.
Example of the OpenTelemetry Collector custom resource when using the Batch Processor
| Parameter | Description | Default |
|---|---|---|
|
| Sends the batch after a specific time duration and irrespective of the batch size. |
|
|
| Sends the batch of telemetry data after the specified number of spans or metrics. |
|
|
|
The maximum allowable size of the batch. Must be equal or greater than the |
|
|
|
When activated, a batcher instance is created for each unique set of values found in the |
|
|
|
When the |
|
3.2. Memory Limiter Processor Copy linkLink copied to clipboard!
The Memory Limiter Processor periodically checks the Collector’s memory usage and pauses data processing when the soft memory limit is reached. This processor supports traces, metrics, and logs. The preceding component, which is typically a receiver, is expected to retry sending the same data and may apply a backpressure to the incoming data. When memory usage exceeds the hard limit, the Memory Limiter Processor forces garbage collection to run.
Example of the OpenTelemetry Collector custom resource when using the Memory Limiter Processor
| Parameter | Description | Default |
|---|---|---|
|
|
Time between memory usage measurements. The optimal value is |
|
|
| The hard limit, which is the maximum amount of memory in MiB allocated on the heap. Typically, the total memory usage of the OpenTelemetry Collector is about 50 MiB greater than this value. |
|
|
|
Spike limit, which is the maximum expected spike of memory usage in MiB. The optimal value is approximately 20% of |
20% of |
|
|
Same as the |
|
|
|
Same as the |
|
3.3. Resource Detection Processor Copy linkLink copied to clipboard!
The Resource Detection Processor identifies host resource details in alignment with OpenTelemetry’s resource semantic standards. Using the detected information, this processor can add or replace the resource values in telemetry data. This processor supports traces and metrics. You can use this processor with multiple detectors such as the Docket metadata detector or the OTEL_RESOURCE_ATTRIBUTES environment variable detector.
The Resource Detection Processor is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
OpenShift Container Platform permissions required for the Resource Detection Processor
OpenTelemetry Collector using the Resource Detection Processor
OpenTelemetry Collector using the Resource Detection Processor with an environment variable detector
- 1
- Specifies which detector to use. In this example, the environment detector is specified.
3.4. Attributes Processor Copy linkLink copied to clipboard!
The Attributes Processor can modify attributes of a span, log, or metric. You can configure this processor to filter and match input data and include or exclude such data for specific actions.
This processor operates on a list of actions, executing them in the order specified in the configuration. The following actions are supported:
- Insert
- Inserts a new attribute into the input data when the specified key does not already exist.
- Update
- Updates an attribute in the input data if the key already exists.
- Upsert
- Combines the insert and update actions: Inserts a new attribute if the key does not exist yet. Updates the attribute if the key already exists.
- Delete
- Removes an attribute from the input data.
- Hash
- Hashes an existing attribute value as SHA1.
- Extract
-
Extracts values by using a regular expression rule from the input key to the target keys defined in the rule. If a target key already exists, it is overridden similarly to the Span Processor’s
to_attributessetting with the existing attribute as the source. - Convert
- Converts an existing attribute to a specified type.
OpenTelemetry Collector using the Attributes Processor
3.5. Resource Processor Copy linkLink copied to clipboard!
The Resource Processor applies changes to the resource attributes. This processor supports traces, metrics, and logs.
OpenTelemetry Collector using the Resource Processor
Attributes represent the actions that are applied to the resource attributes, such as delete the attribute, insert the attribute, or upsert the attribute.
3.6. Span Processor Copy linkLink copied to clipboard!
The Span Processor modifies the span name based on its attributes or extracts the span attributes from the span name. This processor can also change the span status and include or exclude spans. This processor supports traces.
Span renaming requires specifying attributes for the new name by using the from_attributes configuration.
The Span Processor is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
OpenTelemetry Collector using the Span Processor for renaming a span
You can use this processor to extract attributes from the span name.
OpenTelemetry Collector using the Span Processor for extracting attributes from a span name
- 1
- This rule defines how the extraction is to be executed. You can define more rules: for example, in this case, if the regular expression matches the name, a
documentIDattribute is created. In this example, if the input span name is/api/v1/document/12345678/update, this results in the/api/v1/document/{documentId}/updateoutput span name, and a new"documentId"="12345678"attribute is added to the span.
You can have the span status modified.
OpenTelemetry Collector using the Span Processor for status change
3.7. Kubernetes Attributes Processor Copy linkLink copied to clipboard!
The Kubernetes Attributes Processor enables automatic configuration of spans, metrics, and log resource attributes by using the Kubernetes metadata. This processor supports traces, metrics, and logs. This processor automatically identifies the Kubernetes resources, extracts the metadata from them, and incorporates this extracted metadata as resource attributes into relevant spans, metrics, and logs. It utilizes the Kubernetes API to discover all pods operating within a cluster, maintaining records of their IP addresses, pod UIDs, and other relevant metadata.
Minimum OpenShift Container Platform permissions required for the Kubernetes Attributes Processor
OpenTelemetry Collector using the Kubernetes Attributes Processor
3.8. Filter Processor Copy linkLink copied to clipboard!
The Filter Processor leverages the OpenTelemetry Transformation Language to establish criteria for discarding telemetry data. If any of these conditions are satisfied, the telemetry data are discarded. You can combine the conditions by using the logical OR operator. This processor supports traces, metrics, and logs.
The Filter Processor is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
OpenTelemetry Collector custom resource with an enabled Filter Processor
- 1
- Defines the error mode. When set to
ignore, ignores errors returned by conditions. When set topropagate, returns the error up the pipeline. An error causes the payload to be dropped from the Collector. - 2
- Filters the spans that have the
container.name == app_container_1attribute. - 3
- Filters the spans that have the
host.name == localhostresource attribute.
3.9. Cumulative-to-Delta Processor Copy linkLink copied to clipboard!
The Cumulative-to-Delta Processor converts monotonic, cumulative-sum, and histogram metrics to monotonic delta metrics.
You can filter metrics by using the include: or exclude: fields and specifying the strict or regexp metric name matching.
Because this processor calculates delta by storing the previous value of a metric, you must set up the metric source to send the metric data to a single stateful Collector instance rather than a deployment of multiple Collectors.
This processor does not convert non-monotonic sums and exponential histograms.
The Cumulative-to-Delta Processor is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
Example of an OpenTelemetry Collector custom resource with an enabled Cumulative-to-Delta Processor
- 1
- To tie the Collector’s lifecycle to the metric source, you can run the Collector as a sidecar to the application that emits the cumulative temporality metrics.
- 2
- Optional: You can limit which metrics the processor converts by explicitly defining which metrics you want converted in this stanza. If you omit this field, the processor converts all metrics, except the metrics that are listed in the
excludefield. - 3
- Defines the value that you provided in the
metricsfield as an exact match by using thestrictparameter or a regular expression by using theregexparameter. - 4
- Lists the names of the metrics that you want to convert. The processor converts exact matches or matches for regular expressions. If a metric matches both the
includeandexcludefilters, theexcludefilter takes precedence. - 5
- Optional: You can exclude certain metrics from conversion by explicitly defining them here.
3.10. Group-by-Attributes Processor Copy linkLink copied to clipboard!
The Group-by-Attributes Processor groups all spans, log records, and metric datapoints that share the same attributes by reassigning them to a Resource that matches those attributes.
The Group-by-Attributes Processor is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
At minimum, configuring this processor involves specifying an array of attribute keys to be used to group spans, log records, or metric datapoints together, as in the following example:
Example of the OpenTelemetry Collector custom resource when using the Group-by-Attributes Processor
- 1
- Specifies attribute keys to group by.
- 2
- If a processed span, log record, or metric datapoint contains at least one of the specified attribute keys, it is reassigned to a Resource that shares the same attribute values; and if no such Resource exists, a new one is created. If none of the specified attribute keys is present in the processed span, log record, or metric datapoint, then it remains associated with its current Resource. Multiple instances of the same Resource are consolidated.
3.11. Transform Processor Copy linkLink copied to clipboard!
The Transform Processor enables modification of telemetry data according to specified rules and in the OpenTelemetry Transformation Language (OTTL). For each signal type, the processor processes a series of conditions and statements associated with a specific OTTL Context type and then executes them in sequence on incoming telemetry data as specified in the configuration. Each condition and statement can access and modify telemetry data by using various functions, allowing conditions to dictate if a function is to be executed.
All statements are written in the OTTL. You can configure multiple context statements for different signals, traces, metrics, and logs. The value of the context type specifies which OTTL Context the processor must use when interpreting the associated statements.
The Transform Processor is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
Configuration summary
Example of the OpenTelemetry Collector custom resource when using the Transform Processor
| Signal Statement | Valid Contexts |
|---|---|
|
|
|
|
|
|
|
|
|
| Value | Description |
|---|---|
|
| Ignores and logs errors returned by statements and then continues to the next statement. |
|
| Ignores and doesn’t log errors returned by statements and then continues to the next statement. |
|
| Returns errors up the pipeline and drops the payload. Implicit default. |
3.12. Tail Sampling Processor Copy linkLink copied to clipboard!
The Tail Sampling Processor samples traces according to user-defined policies when all of the spans are completed. Tail-based sampling enables you to filter the traces of interest and reduce your data ingestion and storage costs.
The Tail Sampling Processor is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
This processor reassembles spans into new batches and strips spans of their original context.
- In pipelines, place this processor downstream of any processors that rely on context: for example, after the Kubernetes Attributes Processor.
- If scaling the Collector, ensure that one Collector instance receives all spans of the same trace so that this processor makes correct sampling decisions based on the specified sampling policies. You can achieve this by setting up two layers of Collectors: the first layer of Collectors with the Load Balancing Exporter, and the second layer of Collectors with the Tail Sampling Processor.
Example of the OpenTelemetry Collector custom resource when using the Tail Sampling Processor
- 1
- Processor name.
- 2
- Optional: Decision delay time, counted from the time of the first span, before the processor makes a sampling decision on each trace. Defaults to
30s. - 3
- Optional: The number of traces kept in memory. Defaults to
50000. - 4
- Optional: The expected number of new traces per second, which is helpful for allocating data structures. Defaults to
0. - 5
- Definitions of the policies for trace evaluation. The processor evaluates each trace against all of the specified policies and then either samples or drops the trace.
You can choose and combine policies from the following list:
The following policy samples all traces:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following policy samples only traces of a duration that is within a specified range:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The provided
5000and10000values are examples. You can estimate the desired latency values by looking at the earliest start time value and latest end time value. If you omit theupper_threshold_msfield, this policy samples all latencies greater than the specifiedthreshold_msvalue.
The following policy samples traces by numeric value matches for resource and record attributes:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The provided
50and100values are examples.
The following policy samples only a percentage of traces:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The provided
10value is an example.
The following policy samples traces by the status code:
OK,ERROR, orUNSET:Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following policy samples traces by string value matches for resource and record attributes:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- This policy definition supports both exact and regular-expression value matches. The provided
10value in thecache_max_sizefield is an example.
The following policy samples traces by the rate of spans per second:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The provided
35value is an example.
The following policy samples traces by the minimum and maximum number of spans inclusively:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- If the sum of all spans in the trace is outside the range threshold, the trace is not sampled. The provided
2and20values are examples.
The following policy samples traces by
TraceStatevalue matches:Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following policy samples traces by a boolean attribute (resource and record):
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following policy samples traces by a given boolean OTTL condition for a span or span event:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following is an
ANDpolicy that samples traces based on a combination of multiple policies:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The provided
50and100values are examples.
The following is a
DROPpolicy that drops traces from sampling based on a combination of multiple policies:Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following policy samples traces by a combination of the previous samplers and with ordering and rate allocation per sampler:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1 2
- Allocates percentages of spans according to the order of applied policies. For example, if you set the
100value in themax_total_spans_per_secondfield, you can set the following values in therate_allocationsection: the50percent value in thepolicy: <composite_policy_1>section to allocate 50 spans per second, and the25percent value in thepolicy: <composite_policy_2>section to allocate 25 spans per second. To fill the remaining capacity, you can set thealways_samplevalue in thetypefield of thename: <composite_policy_3>section.
3.13. Probabilistic Sampling Processor Copy linkLink copied to clipboard!
If you handle high volumes of telemetry data and seek to reduce costs by reducing processed data volumes, you can use the Probabilistic Sampling Processor as an alternative to the Tail Sampling Processor.
Probabilistic Sampling Processor is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
The processor samples a specified percentage of trace spans or log records statelessly and per request.
The processor adds the information about the used effective sampling probability into the telemetry data:
-
In trace spans, the processor encodes the threshold and optional randomness information in the W3C Trace Context
tracestatefields. - In log records, the processor encodes the threshold and randomness information as attributes.
The following is an example OpenTelemetryCollector custom resource configuration for the Probabilistic Sampling Processor for sampling trace spans:
- 1
- For trace pipelines, the source of randomness is the hashed value of the span trace ID.
- 2
- Required. Accepts a 32-bit floating-point percentage value at which spans are to be sampled.
- 3
- Optional. Accepts a supported string value for a sampling logic mode: the default
hash_seed,proportional, orequalizing. Thehash_seedmode applies the Fowler–Noll–Vo (FNV) hash function to the trace ID and weighs the hashed value against the sampling percentage value. You can also use thehash_seedmode with units of telemetry other than the trace ID. Theproportionalmode samples a strict, probability-based ratio of the total span quantity, and is based on the OpenTelemetry and World Wide Web Consortium specifications. Theequalizingmode is useful for lowering the sampling probability to a minimum value across a whole pipeline or applying a uniform sampling probability in Collector deployments where client SDKs have mixed sampling configurations. - 4
- Optional. Accepts a 32-bit unsigned integer, which is used to compute the hash algorithm. When this field is not configured, the default seed value is
0. If you use multiple tiers of Collector instances, you must configure all Collectors of the same tier to the same seed value. - 5
- Optional. Determines the number of hexadecimal digits used to encode the sampling threshold. Accepts an integer value. The supported values are
1-14. The default value4causes the threshold to be rounded if it contains more than 16 significant bits, which is the case of theproportionalmode that uses 56 bits. If you select theproportionalmode, use a greater value for the purpose of preserving precision applied by preceding samplers. - 6
- Optional. Rejects spans with sampling errors. Accepts a boolean value. The default value is
true.
The following is an example OpenTelemetryCollector custom resource configuration for the Probabilistic Sampling Processor for sampling log records:
- 1
- Required. Accepts a 32-bit floating-point percentage value at which spans are to be sampled.
- 2
- Optional. Accepts a supported string value for a sampling logic mode: the default
hash_seed,equalizing, orproportional. Thehash_seedmode applies the Fowler–Noll–Vo (FNV) hash function to the trace ID or a specified log record attribute and then weighs the hashed value against the sampling percentage value. You can also usehash_seedmode with other units of telemetry than trace ID, for example to use theservice.instance.idresource attribute for collecting log records from a percentage of pods. Theequalizingmode is useful for lowering the sampling probability to a minimum value across a whole pipeline or applying a uniform sampling probability in Collector deployments where client SDKs have mixed sampling configurations. Theproportionalmode samples a strict, probability-based ratio of the total span quantity, and is based on the OpenTelemetry and World Wide Web Consortium specifications. - 3
- Optional. Accepts a 32-bit unsigned integer, which is used to compute the hash algorithm. When this field is not configured, the default seed value is
0. If you use multiple tiers of Collector instances, you must configure all Collectors of the same tier to the same seed value. - 4
- Optional. Determines the number of hexadecimal digits used to encode the sampling threshold. Accepts an integer value. The supported values are
1-14. The default value4causes the threshold to be rounded if it contains more than 16 significant bits, which is the case of theproportionalmode that uses 56 bits. If you select theproportionalmode, use a greater value for the purpose of preserving precision applied by preceding samplers. - 5
- Optional. Defines where to look for the log record attribute in
from_attribute. The log record attribute is used as the source of randomness. Accept the defaulttraceIDvalue or therecordvalue. - 6
- Optional. The name of a log record attribute to be used to compute the sampling hash, such as a unique log record ID. Accepts a string value. The default value is
"". Use this field only if you need to specify a log record attribute as the source of randomness in those situations where the trace ID is absent or trace ID sampling is disabled or theattribute_sourcefield is set to therecordvalue. - 7
- Optional. Rejects spans with sampling errors. Accepts a boolean value. The default value is
true.