The stdev aggregation in APL computes the standard deviation of a numeric field within a dataset. This is useful for understanding the variability or dispersion of data points around the mean. You can apply this aggregation to various use cases, such as performance monitoring, anomaly detection, and statistical analysis of logs and traces.

Use the stdev function to determine how spread out values like request duration, span duration, or response times are. This is particularly helpful when analyzing data trends and identifying inconsistencies, outliers, or abnormal behavior.

For users of other query languages

If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.

Usage

Syntax

stdev(numeric_field)

Parameters

  • numeric_field: The field containing numeric values for which the standard deviation is calculated.

Returns

The stdev aggregation returns a single numeric value representing the standard deviation of the specified numeric field in the dataset.

Use case examples

You can use the stdev aggregation to analyze HTTP request durations and identify performance variations across different requests. For instance, you can calculate the standard deviation of request durations to identify potential anomalies.

Query

['sample-http-logs']
| summarize req_duration_std = stdev(req_duration_ms)

Run in Playground

Output

req_duration_std
345.67

This query calculates the standard deviation of the req_duration_ms field in the sample-http-logs dataset, helping to understand how much variability there is in request durations.

  • avg: Calculates the average value of a numeric field. Use avg to understand the central tendency of the data.
  • min: Returns the smallest value in a numeric field. Use min when you need to find the minimum value.
  • max: Returns the largest value in a numeric field. Use max to identify the peak value in a dataset.
  • sum: Adds up all the values in a numeric field. Use sum to get a total across records.
  • count: Returns the number of records in a dataset. Use count when you need the number of occurrences or entries.