Skip to content

variance - Calculate the variance of an expression

The variance command computes the variance of a given value. This is especially useful for answering the question "Is this value normal?".

Syntax

variance(expression: number)

Arguments

NameTypeRequiredDescription
expressionnumbertrueThe expression whose variance we seek

Example - Computing variance of duration in traces

We can calculate the variance of the duration metadata field for a collection of traces, and group the results by operationName in the following way:

groupby $l.operationName aggregate variance($m.duration)

This will let us know how much the duration of a given operationName varies over the specified timerange.