Caution
Grafana Alloy is the new name for our distribution of the OTel collector. Grafana Agent has been deprecated and is in Long-Term Support (LTS) through October 31, 2025. Grafana Agent will reach an End-of-Life (EOL) on November 1, 2025. Read more about why we recommend migrating to Grafana Alloy.
Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
otelcol.processor.memory_limiter
otelcol.processor.memory_limiter
is used to prevent out of memory situations
on a telemetry pipeline by performing periodic checks of memory usage. If
usage exceeds the defined limits, data is dropped and garbage collections
are triggered to reduce it.
The memory_limiter
component uses both soft and hard limits, where the hard limit
is always equal or larger than the soft limit. When memory usage goes above the
soft limit, the processor component drops data and returns errors to the
preceding components in the pipeline. When usage exceeds the hard
limit, the processor forces a garbage collection in order to try and free
memory. When usage is below the soft limit, no data is dropped and no forced
garbage collection is performed.
NOTE:
otelcol.processor.memory_limiter
is a wrapper over the upstream OpenTelemetry Collectormemorylimiter
processor. Bug reports or feature requests will be redirected to the upstream repository, if necessary.
Multiple otelcol.processor.memory_limiter
components can be specified by
giving them different labels.
Usage
otelcol.processor.memory_limiter "LABEL" {
check_interval = "1s"
limit = "50MiB" // alternatively, set `limit_percentage` and `spike_limit_percentage`
output {
metrics = [...]
logs = [...]
traces = [...]
}
}
Arguments
otelcol.processor.memory_limiter
supports the following arguments:
Name | Type | Description | Default | Required |
---|---|---|---|---|
check_interval | duration | How often to check memory usage. | yes | |
limit | string | Maximum amount of memory targeted to be allocated by the process heap. | "0MiB" | no |
spike_limit | string | Maximum spike expected between the measurements of memory usage. | 20% of limit | no |
limit_percentage | int | Maximum amount of total available memory targeted to be allocated by the process heap. | 0 | no |
spike_limit_percentage | int | Maximum spike expected between the measurements of memory usage. | 0 | no |
The arguments must define either limit
or the limit_percentage, spike_limit_percentage
pair, but not both.
The configuration options limit
and limit_percentage
define the hard
limits. The soft limits are then calculated as the hard limit minus the
spike_limit
or spike_limit_percentage
values respectively. The recommended
value for spike limits is about 20% of the corresponding hard limit.
The recommended check_interval
value is 1 second. If the traffic through the
component is spiky in nature, it is recommended to either decrease the interval
or increase the spike limit to avoid going over the hard limit.
The limit
and spike_limit
values must be larger than 1 MiB.
Blocks
The following blocks are supported inside the definition of
otelcol.processor.memory_limiter
:
Hierarchy | Block | Description | Required |
---|---|---|---|
output | output | Configures where to send received telemetry data. | yes |
output block
The output
block configures a set of components to forward resulting
telemetry data to.
The following arguments are supported:
Name | Type | Description | Default | Required |
---|---|---|---|---|
metrics | list(otelcol.Consumer) | List of consumers to send metrics to. | [] | no |
logs | list(otelcol.Consumer) | List of consumers to send logs to. | [] | no |
traces | list(otelcol.Consumer) | List of consumers to send traces to. | [] | no |
The output
block must be specified, but all of its arguments are optional. By
default, telemetry data is dropped. To send telemetry data to other components,
configure the metrics
, logs
, and traces
arguments accordingly.
Exported fields
The following fields are exported and can be referenced by other components:
Name | Type | Description |
---|---|---|
input | otelcol.Consumer | A value that other components can use to send telemetry data to. |
input
accepts otelcol.Consumer
data for any telemetry signal (metrics,
logs, or traces).
Component health
otelcol.processor.memory_limiter
is only reported as unhealthy if given an invalid
configuration.
Debug information
otelcol.processor.memory_limiter
does not expose any component-specific debug
information.