Open source


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 Collector memorylimiter 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.


otelcol.processor.memory_limiter "LABEL" {
  check_interval = "1s"

  limit = "50MiB" // alternatively, set `limit_percentage` and `spike_limit_percentage`

  output {
    metrics = [...]
    logs    = [...]
    traces  = [...]


otelcol.processor.memory_limiter supports the following arguments:

check_intervaldurationHow often to check memory usage.yes
limitstringMaximum amount of memory targeted to be allocated by the process heap."0MiB"no
spike_limitstringMaximum spike expected between the measurements of memory usage.20% of limitno
limit_percentageintMaximum amount of total available memory targeted to be allocated by the process heap.0no
spike_limit_percentageintMaximum spike expected between the measurements of memory usage.0no

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.


The following blocks are supported inside the definition of otelcol.processor.memory_limiter:

outputoutputConfigures where to send received telemetry data.yes
debug_metricsdebug_metricsConfigures the metrics that this component generates to monitor its

output block

The output block configures a set of components to forward resulting telemetry data to.

The following arguments are supported:

logslist(otelcol.Consumer)List of consumers to send logs to.[]no
metricslist(otelcol.Consumer)List of consumers to send metrics to.[]no
traceslist(otelcol.Consumer)List of consumers to send traces to.[]no

You must specify the output block, but all its arguments are optional. By default, telemetry data is dropped. Configure the metrics, logs, and traces arguments accordingly to send telemetry data to other components.

debug_metrics block

The debug_metrics block configures the metrics that this component generates to monitor its state.

The following arguments are supported:

disable_high_cardinality_metricsbooleanWhether to disable certain high cardinality metrics.trueno
levelstringControls the level of detail for metrics emitted by the wrapped collector."detailed"no

disable_high_cardinality_metrics is the Grafana Alloy equivalent to the telemetry.disableHighCardinalityMetrics feature gate in the OpenTelemetry Collector. It removes attributes that could cause high cardinality metrics. For example, attributes with IP addresses and port numbers in metrics about HTTP and gRPC connections are removed.


If configured, disable_high_cardinality_metrics only applies to otelcol.exporter.* and otelcol.receiver.* components.

level is the Alloy equivalent to the telemetry.metrics.level feature gate in the OpenTelemetry Collector. Possible values are "none", "basic", "normal" and "detailed".

Exported fields

The following fields are exported and can be referenced by other components:

inputotelcol.ConsumerA 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.

Compatible components

otelcol.processor.memory_limiter can accept arguments from the following components:

otelcol.processor.memory_limiter has exports that can be consumed by the following components:


Connecting some components may not be sensible or components may require further configuration to make the connection work correctly. Refer to the linked documentation for more details.