---
title: "otelcol.processor.cumulativetodelta | Grafana Alloy documentation"
description: "Learn about otelcol.processor.cumulativetodelta"
---

# `otelcol.processor.cumulativetodelta`

> **Public preview**: This is a [public preview](/docs/release-life-cycle/) component. Public preview components are subject to breaking changes, and may be replaced with equivalent functionality that cover the same use case. To enable and use a public preview component, you must set the `stability.level` [flag](/docs/alloy/latest/reference/cli/run/) to `public-preview` or below.

`otelcol.processor.cumulativetodelta` accepts metrics from other `otelcol` components and converts metrics with the cumulative temporality to delta.

> Note
> 
> `otelcol.processor.cumulativetodelta` is a wrapper over the upstream OpenTelemetry Collector [`cumulativetodelta`](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/v0.147.0/processor/cumulativetodeltaprocessor) processor. Bug reports or feature requests will be redirected to the upstream repository, if necessary.

You can specify multiple `otelcol.processor.cumulativetodelta` components by giving them different labels.

## Usage

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
otelcol.processor.cumulativetodelta "<LABEL>" {
  output {
    metrics = [...]
  }
}
```

## Arguments

You can use the following arguments with `otelcol.processor.cumulativetodelta`:

Expand table

| Name            | Type       | Description                                                            | Default  | Required |
|-----------------|------------|------------------------------------------------------------------------|----------|----------|
| `initial_value` | `string`   | Handling of the first observed point for a given metric identity.      | `"auto"` | no       |
| `max_staleness` | `duration` | The total time a state entry will live past the time it was last seen. | `"0"`    | no       |

`otelcol.processor.cumulativetodelta` tracks incoming metric streams. Sum and exponential histogram metrics with delta temporality are tracked and converted into cumulative temporality.

If a new sample hasn’t been received since the duration specified by `max_staleness`, tracked streams are considered stale and dropped. When set to `"0"`, the state is retained indefinitely.

The `initial_value` sets the handling of the first observed point for a given metric identity. When the collector (re)starts, there’s no record of how much of a given cumulative counter has already been converted to delta values.

- `"auto"` (default): Send the observed value if the start time is set AND the start time happens after the component started AND the start time is different from the timestamp. This is suitable for gateway deployments. This heuristic is like `drop`, but it keeps values for newly started counters which couldn’t have had previous observed values.
- `"keep"`: Send the observed value as the delta value. This is suitable for when the incoming metrics haven’t been observed before. For example, when you are running the collector as a sidecar, the collector lifecycle is tied to the metric source.
- `"drop"`: Keep the observed value but don’t send it. This is suitable for gateway deployments. It guarantees that all delta counts it produces haven’t been observed before, but drops the values between the first two observations.

## Blocks

You can use the following blocks with `otelcol.processor.cumulativetodelta`:

No valid configuration blocks found.

If metric matches both `include` and `exclude`, exclude takes preference. If neither `include` nor `exclude` are supplied, no filtering is applied.

### `output`

Required

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

The following arguments are supported:

Expand table

| Name      | Type                     | Description                           | Default | Required |
|-----------|--------------------------|---------------------------------------|---------|----------|
| `logs`    | `list(otelcol.Consumer)` | List of consumers to send logs to.    | `[]`    | no       |
| `metrics` | `list(otelcol.Consumer)` | List of consumers to send metrics to. | `[]`    | no       |
| `traces`  | `list(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.

### `include`

The `include` block configures which metrics to convert to delta.

The following attributes are supported:

Expand table

| Name           | Type           | Description                              | Default | Required |
|----------------|----------------|------------------------------------------|---------|----------|
| `match_type`   | `string`       | Match type to use, `strict` or `regexp`. |         | no       |
| `metric_types` | `list(string)` | Metric types to convert to delta.        |         | no       |
| `metrics`      | `list(string)` | Names or patterns to convert to delta.   |         | no       |

If one of `metrics` or `match_type` is supplied, the other must be supplied too.

Valid values for `metric_types` are `sum` and `histogram`.

### `exclude`

The `exclude` block configures which metrics not to convert to delta. `exclude` takes precedence over `include`

The following attributes are supported:

Expand table

| Name           | Type           | Description                                            | Default | Required |
|----------------|----------------|--------------------------------------------------------|---------|----------|
| `match_type`   | `string`       | Match type to use, `strict` or `regexp`.               |         | no       |
| `metric_types` | `list(string)` | Metric types to exclude when converting to delta.      |         | no       |
| `metrics`      | `list(string)` | Names or patterns to exclude when converting to delta. |         | no       |

If one of `metrics` or `match_type` is supplied, the other must be supplied too.

Valid values for `metric_types` are `sum` and `histogram`.

### `debug_metrics`

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

The following arguments are supported:

Expand table

| Name                               | Type      | Description                                          | Default | Required |
|------------------------------------|-----------|------------------------------------------------------|---------|----------|
| `disable_high_cardinality_metrics` | `boolean` | Whether to disable certain high cardinality metrics. | `true`  | no       |

`disable_high_cardinality_metrics` is the 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.

## Exported fields

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

Expand table

| Name    | Type               | Description                                                      |
|---------|--------------------|------------------------------------------------------------------|
| `input` | `otelcol.Consumer` | A value that other components can use to send telemetry data to. |

`input` accepts `otelcol.Consumer` data for metrics.

## Component health

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

## Debug information

`otelcol.processor.cumulativetodelta` doesn’t expose any component-specific debug information.

## Example

This example converts cumulative temporality metrics to delta before sending it to [`otelcol.exporter.otlphttp`](../otelcol.exporter.otlphttp/) for further processing.

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
otelcol.processor.cumulativetodelta "default" {
  output {
    metrics = [otelcol.exporter.otlphttp.production.input]
  }
}

otelcol.exporter.otlphttp "production" {
  client {
    endpoint = sys.env("OTLP_SERVER_ENDPOINT")
  }
}
```

## Compatible components

`otelcol.processor.cumulativetodelta` can accept arguments from the following components:

- Components that export [OpenTelemetry `otelcol.Consumer`](../../../compatibility/#opentelemetry-otelcolconsumer-exporters)

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

- Components that consume [OpenTelemetry `otelcol.Consumer`](../../../compatibility/#opentelemetry-otelcolconsumer-consumers)

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