align

Type of operation: Aggregate, Metrics

Description

Align raw metrics onto a time grid (defined by the input period) by aggregating nearby data points together.

If frame is not specified, align aggregates all points between two grid points (tumbling window aggregation). If frame is specified, align aggregates all data points that fall into a frame relative to each grid point (sliding window aggregation).

Usage

align period [ , frame ], metricAligningExpression ...

Argument

Type

Required

Multiple

period

duration

Required

Only one

frame

frame

Optional

Only one

metricAligningExpression

expression

Required

Can be multiple

Accelerable

align is always accelerable if the input is accelerable. A dataset that only uses accelerable verbs, can be accelerated, making queries on the dataset respond faster.

Examples

align 5m, requests: rate(m("requests_total"))

Computes the per-second rate of “requests_total” metric for each 5m time bins.

align 5m, requests: rate(m("requests_total")), memory_used: avg(m("memory_used"))

Computes the per-second rate of “requests_total” metric and the average of “memory_used” metric, for each 5m time bins.

align 1m, frame(back: 10m), memory_used: avg(m("memory_used"))

Computes the moving average of “memory_used” metric in the past 10m, for each 1m step. Note that frame() may not be exact for better performance.

align 1m, frame_exact(back: 118s), memory_used: avg(m("memory_used"))

Computes the moving average of “memory_used” metric in the past exact 118s, for each 1m step.