Aggregate

status: beta egress: stream state: stateful

Configuration

inputs

required [string]

A list of upstream source or transform IDs. Wildcards (*) are supported but must be the last character in the ID.

See configuration for more info.

Array string literal
Examples
[
  "my-source-or-transform-id",
  "prefix-*"
]

interval_ms

common optional uint
The interval over which metrics are aggregated in milliseconds. Over this period metrics with the same series data (name, namespace, tags, …) will be aggregated.
default: 10000 (milliseconds)

Telemetry

Metrics

link

aggregate_events_recorded_total

counter
The number of events recorded by the aggregate transform.
component_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.

aggregate_failed_updates

counter
The number of failed metric updates, incremental adds, encountered by the aggregate transform.
component_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.

aggregate_flushes_total

counter
The number of flushes done by the aggregate transform.
component_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.

events_in_total

counter
The number of events accepted by this component either from tagged origin like file and uri, or cumulatively from other origins.
component_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.
container_name optional
The name of the container from which the event originates.
file optional
The file from which the event originates.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the event originates.
peer_path optional
The pathname from which the event originates.
pod_name optional
The name of the pod from which the event originates.
uri optional
The sanitized URI from which the event originates.

events_out_total

counter
The total number of events emitted by this component.
component_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.

processed_bytes_total

counter
The number of bytes processed by the component.
component_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.
container_name optional
The name of the container from which the bytes originate.
file optional
The file from which the bytes originate.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the bytes originate.
peer_path optional
The pathname from which the bytes originate.
pod_name optional
The name of the pod from which the bytes originate.
uri optional
The sanitized URI from which the bytes originate.

processed_events_total

counter
The total number of events processed by this component. This metric is deprecated in place of using events_in_total and events_out_total metrics.
component_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.

Examples

Given this event...
[
  {
    "metric": {
      "counter": {
        "value": 1.1
      },
      "kind": "incremental",
      "name": "counter.1",
      "tags": {
        "host": "my.host.com"
      },
      "timestamp": "2021-07-12T07:58:44.223543Z"
    }
  },
  {
    "metric": {
      "counter": {
        "value": 2.2
      },
      "kind": "incremental",
      "name": "counter.1",
      "tags": {
        "host": "my.host.com"
      },
      "timestamp": "2021-07-12T07:58:45.223543Z"
    }
  },
  {
    "metric": {
      "counter": {
        "value": 1.1
      },
      "kind": "incremental",
      "name": "counter.1",
      "tags": {
        "host": "different.host.com"
      },
      "timestamp": "2021-07-12T07:58:45.223543Z"
    }
  },
  {
    "metric": {
      "counter": {
        "value": 22.33
      },
      "kind": "absolute",
      "name": "gauge.1",
      "tags": {
        "host": "my.host.com"
      },
      "timestamp": "2021-07-12T07:58:47.223543Z"
    }
  },
  {
    "metric": {
      "counter": {
        "value": 44.55
      },
      "kind": "absolute",
      "name": "gauge.1",
      "tags": {
        "host": "my.host.com"
      },
      "timestamp": "2021-07-12T07:58:45.223543Z"
    }
  }
]
...and this Vector configuration...
{
  "inputs": null,
  "interval_ms": 5000,
  "type": null
}
...this Vector metric event is produced:
[
  {
    "counter": {
      "value": 3.3
    },
    "kind": "incremental",
    "name": "counter.1",
    "tags": {
      "host": "my.host.com"
    },
    "timestamp": "2021-07-12T07:58:45.223543Z"
  },
  {
    "counter": {
      "value": 1.1
    },
    "kind": "incremental",
    "name": "counter.1",
    "tags": {
      "host": "different.host.com"
    },
    "timestamp": "2021-07-12T07:58:45.223543Z"
  },
  {
    "counter": {
      "value": 44.55
    },
    "kind": "absolute",
    "name": "gauge.1",
    "tags": {
      "host": "my.host.com"
    },
    "timestamp": "2021-07-12T07:58:45.223543Z"
  }
]

How it works

Advantages of Use

The major advantage to aggregation is the reduction of volume. It may reduce costs directly in situations that charge by metric event volume, or indirectly by requiring less CPU to process and/or less network bandwidth to transmit and receive. In systems that are constrained by the processing required to ingest metric events it may help to reduce the processing overhead. This may apply to transforms and sinks downstream of the aggregate transform as well.

Aggregation Behavior

Metrics are aggregated based on their kind. During an interval, incremental metrics are “added” and newer absolute metrics replace older ones in the same series. This results in a reduction of volume and less granularity, while maintaining numerical correctness. As an example, two incremental counter metrics with values 10 and 13 processed by the transform during a period would be aggregated into a single incremental counter with a value of 23. Two absolute gauge metrics with values 93 and 95 would result in a single absolute gauge with the value of 95. More complex types like distribution, histogram, set, and summary behave similarly with incremental values being combined in a manner that makes sense based on their type.

State

This component is stateful, meaning its behavior changes based on previous inputs (events). State is not preserved across restarts, therefore state-dependent behavior will reset between restarts and depend on the inputs (events) received since the most recent restart.