Menu
Open source

Experimental

otelcol.processor.interval

EXPERIMENTAL: This is an experimental component. Experimental components are subject to frequent breaking changes, and may be removed with no equivalent replacement. The stability.level flag must be set to experimental to use the component.

otelcol.processor.interval aggregates metrics and periodically forwards the latest values to the next component in the pipeline. The processor supports aggregating the following metric types:

  • Monotonically increasing, cumulative sums
  • Monotonically increasing, cumulative histograms
  • Monotonically increasing, cumulative exponential histograms
  • Gauges
  • Summaries

The following metric types will not be aggregated and will instead be passed, unchanged, to the next component in the pipeline:

  • All delta metrics
  • Non-monotonically increasing sums

Note

Aggregating data over an interval is an inherently lossy process. You lose precision for monotonically increasing cumulative sums, histograms, and exponential histograms, but you don’t lose overall data. You can lose data when you aggregate non-monotonically increasing sums, gauges, and summaries. For example, a value can increase and decrease to the original value, and you can lose this change in the aggregation. In most cases, this type of data loss is OK. However, you can change the configuration so that these changed values pass through and are not aggregated.

Warning

After exporting, any internal state is cleared. If no new metrics come in, the next interval will export nothing.

Note

otelcol.processor.interval is a wrapper over the upstream OpenTelemetry Collector interval processor. Bug reports or feature requests will be redirected to the upstream repository, if necessary.

Usage

alloy
otelcol.processor.interval "LABEL" {
  output {
    metrics = [...]
  }
}

Arguments

otelcol.processor.interval supports the following arguments:

NameTypeDescriptionDefaultRequired
intervaldurationThe interval in the processor should export the aggregated metrics."60s"no

Blocks

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

HierarchyBlockDescriptionRequired
outputoutputConfigures where to send received telemetry data.yes
passthroughpassthroughConfigure metric types to be passed through instead of aggregated.no
debug_metricsdebug_metricsConfigures the metrics that this component generates to monitor its state.no

output block

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

The following arguments are supported:

NameTypeDescriptionDefaultRequired
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.

passthrough block

The passthrough block configures which metric types should be passed through instead of being aggregated.

The following attributes are supported:

NameTypeDescriptionDefaultRequired
gaugeboolDetermines whether gauge metrics should be passed through as they are or aggregated.falseno
summaryboolDetermines whether summary metrics should be passed through as they are or aggregated.falseno

debug_metrics block

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

The following arguments are supported:

NameTypeDescriptionDefaultRequired
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.

Note

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:

NameTypeDescription
inputotelcol.ConsumerA value that other components can use to send telemetry data to.

input accepts otelcol.Consumer data for metrics.

Component health

otelcol.processor.interval is only reported as unhealthy if given an invalid configuration.

Debug information

otelcol.processor.interval does not expose any component-specific debug information.

Example

This example receives OTLP metrics and aggregates them for 30s before sending to the next exporter.

alloy
otelcol.receiver.otlp "default" {
  grpc { ... }
  http { ... }

  output {
    metrics = [otelcol.processor.interval.default.input]
  }
}

otelcol.processor.interval "default" {
  interval = "30s"
  output {
    metrics = [otelcol.exporter.otlphttp.grafana_cloud.input]
  }
}

otelcol.exporter.otlphttp "grafana_cloud" {
  client {
    endpoint = "https://otlp-gateway-prod-gb-south-0.grafana.net/otlp"
    auth     = otelcol.auth.basic.grafana_cloud.handler
  }
}

otelcol.auth.basic "grafana_cloud" {
  username = env("GRAFANA_CLOUD_USERNAME")
  password = env("GRAFANA_CLOUD_API_KEY")
}
TimestampMetric NameAggregation TemporarilityAttributesValue
0test_metricCumulativelabelA: foo4.0
2test_metricCumulativelabelA: bar3.1
4other_metricDeltafruitType: orange77.4
6test_metricCumulativelabelA: foo8.2
8test_metricCumulativelabelA: foo12.8
10test_metricCumulativelabelA: bar6.4

The processor immediately passes the following metric to the next processor in the chain because it is a Delta metric.

TimestampMetric NameAggregation TemporarilityAttributesValue
4other_metricDeltafruitType: orange77.4

At the next interval (15s by default), the processor passed the following metrics to the next processor in the chain.

TimestampMetric NameAggregation TemporarilityAttributesValue
8test_metricCumulativelabelA: foo12.8
10test_metricCumulativelabelA: bar6.4

Compatible components

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

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

Note

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.