The AOC provides an Expression statement type for performing arithmetic and combining queries. Currently, Expression statements support 3 operations: Eval: For simple arithmetic and combination of queries Rolling Aggregate: For generating rolling aggregates (e.g sum, average etc.) on specific time-window * TopN: For ranking and capturing top N values
Eval enables arithmetic operations and combinations of query results. Query statements and other expression statements can be referenced using their alphabet name prefixed with
$. In below example:
- Query A: Overall HTTP throughput
- Query B: Throughput of HTTP status code = 200 i.e. HTTP successful requests
- Eval Expression C:
( 1 - $B/$A ) x 100; returns the error rate for HTTP requests, since
$B/$Awill give HTTP success rate.
All python comparison, arithmetic and membership operators are supported (see python doc here):
- addition, substraction:
- multiplication, division:
- modulus, floor division, exponent:
- conjunction, disjunction, negation:
- supported math functions:
Rolling aggregates provide capability to apply a function such as average, sum, etc. to data points in a rolling time window. Below examples apply mean function to throughput data for 1 min and 5 min time window. The original throughput query (query A) is generating HTTP throughput per second. The rolling aggregate average over 1 min will take all the throughput data points for t - 1 min time window and plot their average at time t. Rolling aggregates are very valuable to smooth-out temporary fluctuations in data.
TopN function essentially ranks the values and returns the Top N values. By default the ranking is in descending order but can be changed by checking the ascending box. In order to use TopN function, we need to group the data on at least one attribute; otherwise there won't be any criteria to rank the values. In below example, the HTTP throughput is grouped by URI path. The TopN function is then applied to return the top 3 URI paths with highest average throughput.
Join our Public Slack Channel if you have any questions.