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

Align is accelerable when the period argument is specified.

## Usage¶

align [ period ] [ , frame ], metricAligningExpression ...


Argument

Type

Required

Multiple

period

duration

Optional

Only one

frame

frame

Optional

Only one

metricAligningExpression

expression

Required

Can be multiple

## Accelerable¶

align is sometimes accelerable, depending on options used. 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.

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


Computes the per-second rate of “requests_total” metric in the past 5 minutes, for each step. The step size will be determined dynamically to make the chart human-readable. It’s determined based on the query window and a number of other parameters such as chart resolution. This formulation is not accelerable.