Overview
Slung supports five aggregation operations that process time-series data and return a single computed value.Aggregation Operations
AVG - Average
Calculates the arithmetic mean of all matching data points. Syntax:sum / count.
MIN - Minimum
Finds the smallest value among all matching data points. Syntax:tag3 or tag4.
Implementation: Initialized to positive infinity, updated with the smaller value on each comparison.
MAX - Maximum
Finds the largest value among all matching data points. Syntax:tag5 but not tag6.
Implementation: Initialized to negative infinity, updated with the larger value on each comparison.
SUM - Summation
Adds together all values from matching data points. Syntax:tag7 tag within the time range.
Common Use Cases:
- Total request counts
- Total bytes transferred
- Cumulative error counts
s1 series where the enabled tag is present.
COUNT - Count
Counts the number of matching data points. Syntax:tag8 in the specified time range.
Common Use Cases:
- Number of requests
- Event occurrences
- Active instances
Omitting the Operation
The operation field is optional. When omitted, Slung defaults to
SUM behavior internally, but you can use it to retrieve individual matching values instead of aggregated results.Combining with Tag Filters
All aggregation operations support the full range of tag filtering capabilities:h-9.
Performance Considerations
- COUNT is typically the fastest operation as it only increments a counter
- MIN and MAX require a single comparison per data point
- AVG and SUM involve arithmetic operations on each data point
- Narrow your tag filters to reduce the number of data points processed
- Use time ranges to limit the dataset when possible
Related Topics
Query Syntax
Full query DSL reference
Tags
Tag filtering operators