# Aggregations

# Overview

Aggregations power your metrics. Since you've decided what data you want with a filter, how often to calculate it with an interval and how to slice it with groupings -- now it's time to actually decide what to aggregate.

Each aggregation has four components:

Component Description
Filter Name Name to describe the aggregation
Sub Filter Jpath filter to further narrow your aggregation. Similar to filter, sub-filter is defined using JPath. For more details, see JPath
Calculations The computation(s) to perform
Field The property on your events to perform the calculation on. If your only calculation is Count, a Field is not necessary.

# Calculations

Calculations are the statistical computations you want to run to achieve your metrics. Each aggregation can have any combination of calculations.

Aggregations.io supports the following Calculations:

Calculation Description
Min (Minimum) the smallest value in the field defined
Max (Maximum) the largest value in the field defined
Avg (Average) the average value for the field defined
Sum Summation of all non-null numerical values in the field
Count A count of events matching the filter & (optional) sub-filter. No field needs to be defined if Count is the only calculation.
Approx Distinct Count An estimated count of unique values in the field defined. Computed using an adaptive sample with a maximum ~2% margin of error (although typically much lower)
Percentile Percentile distribution for the field defined. You can define the percentile value desired at retrieval time. Percentiles are calculated by maintaing a t-digest state.

# Non Numeric Fields

If a field defined is found to contain a non-numerical value or not exist on a given payload - it will not be used for the calculation.

For example, if the aggregation is defined as Sum, Count, Avg for @.num and the following events are sent:

[
    {"num":2},
    {"num":4},
    {"num":0},
    {"num":"apples"}
]
  • The Sum will be 6
  • The Avg will be 2
  • The Count will be 4