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

When options(bins: <N>) is specified, Observe will pick a user friendly bin size that produces at most N bins across the query window. And when it is set to 1, Observe will produce one single time bin that matches the query window exactly. This option is not accelerable as it is query window dependant.

Align is accelerable when the period argument is specified.

Usage

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

Argument

Type

Required

Multiple

options

options

Optional

Only one

period

duration

Optional

Only one

frame

frame

Optional

Only one

metricAligningExpression

expression

Required

Can be multiple

Options

Option

Type

Meaning

bins

int64

Sets the maximum number of bins to produce (not accelerable)

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.

align options(bins: 100), memory_used: avg(m("memory_used"))

Computes the average for each time-series of “memory_used” metric over time.

The time bin size will be determined dynamically to make the chart human-readable, and it will produce no more than 100 points for each time-series in the query window.

For example:

  • when query window is 1 hour, 1 minute bins will be produced

  • when query window is 4 hours, 5 minutes bins will be produced

  • when query window is 1 day, 30 minutes bins will be produced

This formulation is not accelerable.

align options(bins: 1), memory_used: avg(m("memory_used"))

Computes the average for each time-series of “memory_used” metric during the query window.

This formulation is not accelerable.