Query Language
The Outlyer analytics engine provides a powerful query language with 100’s of functions to select and transform your time series metrics in real time. This guide provides an overview of the key functions and capabilities of the query language for more advanced users who want to go beyond the queries available in our user interface Query builder.
At the core, Outlyer’s query language is designed to be a stable method of representing complex data queries in a URL-friendly format. It is loosely based on the Reverse Polish Notation (RPN) expressions supported by Tobias Oetiker’s rrdtool. If you ever used an HP scientific calculator you may already be familiar with RPN and you can think of it as a stack of commands that can be read backwards to create and transform a query in Outlyer.
The following is an example of a RPN query expression:
name,sys.cpu_pct,:eq,:avg,(,host,),:by
If you’re familiar with SQL, this is the equivalent of:
select avg(*) from time_series where name = 'sys.cpu_pct' group by 'host'
This query will find the metric with name sys.cpu_pct
, get the average and then group by host
. By using the group by,
a seperate time series will be returned for every host reporting that metric. Any metric label can be selected on or grouped on.
For example if our metrics have the label aws.region
and we group on that we could show the aggregated average CPU usage across
all our hosts by each region.
If you want to transform this query further to apply addional functions to the time series returned by this query you can simply append the additional functions to the end of the RPN query:
name,sys.cpu_pct,:eq,:avg,(,host,),:by,:cf-max
This will take the original query above and apply the :cf-max
function to each time series to force Outlyer to consolidate each
step size to pick the maximum data point for that period, when increasing the step size for graphing.
Query Language Functions
The Outlyer query language provides functions that start with a :
to select and transform your original time series for queries.
These can generally be organized into the following categories:
- Selection Functions: These functions select the aggregated and summarized time series for the query.
- Math Functions: These functions can perform maths against the time series to compute new time series.
- Advanced Functions: A collection of more advanced functions to filter out noise and outliers in your time series.