var()

var(col) returns the sample variance of the values in the provided column.

Non-numeric values are ignored. Variance requires at least two values to calculate; if the provided column does not have enough numeric values or the column does not exist, var will return null.

Returns

A table with one row and one column, called @q.var.

Example

Compute the variance of elapsed time in milliseconds for requests in the checkout_api service, aggregated by host.

kubernetes.container_name: "checkout_api"
| stats var(log.%kv.elapsed_ms) by host

Last updated