MetoroQL
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:
- Counters return the delta of consecutive values by default
- Queries can be over resource types other than metrics
- 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 should not apply
rate()
orincrease()
functions to chart 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()
.
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 datatraces
- Distributed tracing datakubernetes_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 behaviour differs from the default promql behaviour.
Basic Query Syntax
A simple MetoroQL timeseries 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 timeseries or between multiple timeseries
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 have their own rules on how they can be queried.
Log Queries
- Log queries just support only the count aggregate.
- They support all filtering and group by operation.
- Structured json logs attributes are parsed into filterable fields.
Trace Queries
- Trace queries support both the
count
aggregation and thetrace_duration_quantile
. - They support all filtering and group by operation.
- All custom attributes are queryable for filtering and group bys
Kubernetes Resources Queries
- Trace queries support both the
count
aggregation and all other aggerations after thejson_path
function is applied. - They support all filtering and group by operation.
With json_path
, you can:
- Extract and analyze specific fields from Kubernetes resources
- Use
sum
,avg
,min
, ormax
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:
Was this page helpful?