Aggregators
You can use aggregations at query time to summarize result data. The following aggregators are available:
Analytics Aggregators¶
eventCount¶
eventCount computes the number of TelemetryDeck events in the query.
userCount¶
userCount computes the number of unique users in the query.
histogram¶
histogram computes the histogram of a metric. By default, it computes the histogram of the floatValue metric, because that's the only metric that is guaranteed to be a numerical value in TelemetryDeck events.
{
"type" : "histogram",
"name" : <output_name, defaults to "Histogram">,
"fieldName" : <metric_name, defaults to floatValue>,
"numBuckets" : <number_of_buckets, defaults to 10>
}
Numerical Aggregators¶
Count¶
count computes the count of rows that match the filters.
DoubleSum¶
doubleSum computes and stores the sum of values as a 64-bit floating point value.
The doubleSum aggregator takes the following properties:
name: Output name for the summed valuefieldName: Name of the metric column to sum over
DoubleMin¶
doubleMin computes the minimum of all metric values and Double.POSITIVE_INFINITY.
DoubleMax¶
doubleMax computes the maximum of all metric values and Double.NEGATIVE_INFINITY.
Averaging Aggregators¶
DoubleMean¶
doubleMean computes and returns the arithmetic mean of a column's values as a 64-bit floating point value.
Warning: this aggregator is mean 😡😡
Unique Aggregators¶
ThetaSketch¶
A theta sketch gives you the number of unique values that a dimension has in your query.
Theta sketches are a probabilistic data structure used for the count-distinct problem. They allow us to quickly count elements in sets, such as the set of users in the aggregation buckets
More on ThetaSketches
A Theta sketch object can be thought of as a Set data structure. At query time, sketches are read and aggregated (set unioned) together. By default, you receive the estimate of the number of unique entries in the sketch object.
Also, you can use post aggregators to do union, intersection or difference on sketch columns in the same row. This means you can create distinct sets of users and compare them against each other. This is necessary for retention and funnel queries.
Cardinality¶
cardinality computes the cardinality of a dimension.
Deprecated
This aggregator is deprecated. Use thetaSketch instead.
First and Last Aggregators¶
DoubleFirst¶
doubleFirst computes the first value of all metric values.
DoubleLast¶
doubleLast computes the last value of all metric values.
StringFirst¶
stringFirst computes the first value of all metric values.
StringLast¶
stringLast computes the last value of all metric values.
ANY Aggregators¶
DoubleAny¶
Returns any value including null. This aggregator can simplify and optimize the performance by returning the first encountered value (including null).
doubleAny returns any double metric value.
StringAny¶
Returns any value including null. This aggregator can simplify and optimize the performance by returning the first encountered value (including null).
stringAny returns any string metric value.
Misc¶
Filtered¶
A filtered aggregator wraps any given aggregator, but only aggregates the values for which the given dimension filter matches.
This makes it possible to compute the results of a filtered and an unfiltered aggregation simultaneously, without having to issue multiple queries, and use both results as part of post-aggregations.
Note: If only the filtered results are required, consider putting the filter on the query itself, which will be much faster since it doesn't require scanning all the data.
Filtered aggregators also support relative time intervals.