Skip to content

sample_stddev - Calculate standard deviation over data sample

Computes the standard deviation of a numerical expression in the group, when there are known substantial missing values.

NOTE: The sample_stddev function is designed when you know you're missing substantial values in a given timerange, for example if you are heavily sampling your trace data.

Syntax

sample_stddev(expression: number): number

Arguments

Name Type Required Description
expression number true The expression for which we will find the sample standard deviation

Example - Calculate standard deviation of API latency using trace Data

Traces always come with an associated field duration as part of their metadata. This value is a number and understanding its standard deviation is powerful for understanding the normal variance of API performance.

groupby $m.operationName aggregate sample_stddev($m.duration)

Example - Calculate standard deviation of HTTP byte responses for request profiling

Understanding the normal variance of your HTTP response sizes will give a clear metric for indicating when HTTP responses are non-standard. Non-standard HTTP response volumes can be a sign of data exfiltration.

groupby $d.path aggregate sample_stddev($d.http_resp_bytes)