Learn how to get started with Wavefront Query Language.

The Wavefront Query Language has been designed especially for time series data. Time series data is unique and requires a query language that accommodates the periodicity, potential irregularity, and streaming nature of the data.

Watch these videos to get you started:

introduction to query language

Basic Query

The simplest and most commonly used type of query retrieves an individual metric: ts(<metricName>). If you are new to Wavefront, you might, for example, want to measure the time spent in the CPU idle task—cpu.idle—across all sources. For this example you enter ts(cpu.idle) into a query field to produce the chart below:

base query

Filtering by Source

The example chart displays many lines, particularly below 8M. To simplify the chart, you can filter by source using the optional source=<sourceName> parameter: ts(<metricName>, source=<sourceName>). For example, use a source="m*" filter to show all sources that start with “m”. The number of lines is reduced and the Y-axis scale changes from 30M to 5M:

filtered query

Applying Aggregation Functions

For further exploration try one of the aggregation functions. Aggregation functions are the second most common query. For example, use avg() to show the average value of the cpu.idle metric across all sources. Or use sum() to get a total for all sources starting with “m”. Here’s the chart adding sum():

summed query

Applying Mathematical Functions

Notice how the result of sum(ts(cpu.idle)) is slowly increasing over time. To increase your proficiency in the language and to learn the power of the other functions, you can take a metric example and experiment with the different functions. For example, we see that sum(ts(cpu.idle)) gives us snapshots of the sum over time, but does not provide information such as how fast the sum is increasing. The query language has a deriv() function that shows the rate of change per second: deriv(sum(ts(cpu.idle)).

summed rate query

Next Steps

Wavefront documentation includes tutorials, reference, and guides on the query language. And the query builder and query wizard can help you come up to speed quickly while using the product.

For more query language tutorial examples, see the Getting Started with Wavefront Query Language getting started dashboard and the tutorial Tutorial: Getting Started.

Once you have experimented with simple use cases, review Wavefront Query Language Quick Reference. The language reference gives an overview of the different types of functions that can be used in a query.

From within the product, you can experiment with the query builder and the query wizard.

For in-depth discussions and examples, see some of the advanced function guides.