Skip to main content
MetoroQL (mQL for short) is Metoro’s query language for observability data. It’s designed to be familiar to users of PromQL but with several important enhancements that make it more powerful for querying across different types of observability data.

Overview

MetoroQL has a PromQL-like syntax but provides unified access to different types of data:
  • Metrics (both standard and custom)
  • Logs
  • Traces
  • Kubernetes resources
This allows you to correlate and analyze data from different sources using a consistent query language.

Key Differences from PromQL

MetoroQL is generally a subset of promql with a few notable difference:
  1. Counters return the delta of consecutive values by default
  2. Queries can be over resource types other than metrics
  3. Timeseries queries must have an aggregate applied to them

Counter Handling

In PromQL, counter metrics require explicit functions like rate() or increase() to calculate the rate of change. In MetoroQL, counter values are automatically presented as the difference between consecutive data points. This means:
  • Values represent changes between points rather than cumulative values
  • You usually do not need rate() or increase() just to see counter changes
For example, consider a HTTP request counter metric with one minute buckets:
The MetoroQL query will directly show the change in request count between data points, while in PromQL, the raw http_requests_total would show monotonically increasing cumulative values that generally aren’t immediately useful without applying rate() or increase().

Rolling Window Functions

For scalar metrics, MetoroQL also supports PromQL-style range functions when importing or writing queries that already use lookback windows:
  • rate(metric[5m])
  • irate(metric[1m])
  • increase(metric[10m])
  • avg_over_time(metric[5m])
  • sum_over_time(metric[5m])
  • min_over_time(metric[5m])
  • max_over_time(metric[5m])
These functions are implemented as rolling-window transforms that run before the final aggregation. For example:
Metoro first calculates the rolling transform for each underlying time series, then applies avg across the service grouping. Counter-based rate, irate, and increase operate on Metoro’s reset-corrected bucket deltas.
These range functions are New Relic-style rolling-window approximations. They are not exact Prometheus extrapolation or staleness semantics. If the chart bucket size is larger than the lookback, Metoro uses the bucket size as the effective window. In this version, irate uses the same rolling-rate machinery as rate.

Multi-domain Queries

One of the most powerful features of MetoroQL is the ability to query across different observability domains using special metric names:
  • logs - Log data
  • traces - Distributed tracing data
  • kubernetes_resources - Kubernetes resources information
  • Any other metric identifier is treated as a regular metric
Each of these domains has specific functions and aggregations that can be applied to them.

Forced aggregations

In mQL all timeseries queries require an explicit aggregation function such as:
  • sum
  • avg
  • min
  • max
  • count
  • histogram_quantile
For example
This behavior differs from the default PromQL behavior.

Basic Query Syntax

A simple MetoroQL time-series query has the following structure:
For example, to get the CPU usage of all services running in the default namespace:
You can also perform arithmetic on a time series or between multiple time series. For example, to get the percent of allocated disk actually used by a service:

Special Data Types

In addition to metrics, you can write mQL queries over logs, traces, and kubernetes_resources. Each of these resources has its own rules on how it can be queried.

Log Queries

  • Log queries support only the count aggregate.
  • They support all filtering and group-by operations.
  • Structured JSON log attributes are parsed into filterable fields.

Trace Queries

  • Trace queries support both the count aggregation and the trace_duration_quantile aggregation.
  • They support all filtering and group-by operations.
  • All custom attributes are queryable for filtering and group-bys.

Kubernetes Resource Queries

  • Kubernetes resource queries support both the count aggregation and all other aggregations after the json_path function is applied.
  • They support all filtering and group-by operations.
With json_path, you can:
  • Extract and analyze specific fields from Kubernetes resources
  • Use sum, avg, min, or max aggregations with the extracted values

Advanced Features

Filtering

MetoroQL supports several filtering operators:

Binary Operations

You can create complex queries using arithmetic operations. Supported operations are:
  • + addition
  • - subtraction
  • * multiplication
  • / division
  • % modulo
  • ^ exponentiation
  • == equal
  • != not equal
  • <= less than or equal
  • >= greater than or equal

Grouping

Group data by specific labels: