PromQL Support
Circonus' CAQL engine supports the PromQL query language through use of the #lang directive. Anywhere that supports a CAQL query can utilize this to run PromQL queries instead. The engine will translate the PromQL into CAQL, and execute it.
#lang="promql" http_requests_total{job="apiserver", handler="/api/comments"}
Supported Functions
Below you’ll find the PromQL functions that we directly support and their CAQL equivalents. CAQL find is used to fetch the data in most cases (any exceptions are marked below). To emulate the staleness behavior of PromQL (“lookback delta”), the data from the fetch/find is piped through the CAQL function fill:forward with the 5m default (which can be overridden using the CAQL #lookback_window directive).
PromQL Function |
CAQL Equivalent |
Notes |
arithmetic operators (+-*/%^) |
op:add,sub,prod,div2,mod,exp |
|
vector to scalar filter comparison (==,!=,>,<,>=,<=) |
filter:values:eq,not:eq,gt,lt,geq,leq([scalar]) |
|
vector to scalar bool comparison (==,!=,>,<,>=,<= bool) |
op:eq,not(eq),gt,lt,geq,leq([scalar]) |
|
abs(instant_vector) |
math:abs |
|
absent(instant_vector) |
stats:absent |
|
absent_over_time(range_vector) |
rolling:absent |
|
acos, acosh(instant_vector) |
math:acos,acosh |
|
and |
op:and |
|
asin, asinh(instant_vector) |
math:asin,asinh |
|
atan, atanh(instant_vector) |
math:atan,atanh |
|
avg(instant_vector) |
stats:mean |
|
avg by (labels) (instant_vector) |
group_by:mean |
|
avg_over_time(range_vector) |
rolling:mean |
|
bottomk(n, instant_vector) |
opt:fetch(numeric, average, "bottomk, n") |
|
ceil(instant_vector) |
math:ceil |
|
changes(range_vector) |
rolling:changes |
|
clamp, clamp_max, clamp_min(instant_vector, [min, max]) |
stats:clamp |
|
cos, cosh(instant_vector) |
math:cos,cosh |
|
count(instant_vector) |
stats:count |
|
count by (labels) (instant_vector) |
group_by:count |
|
count_over_time(range_vector) |
rolling:count |
|
deg(instant_vector) |
math:deg |
|
delta(range_vector) |
rolling:delta |
|
deriv(range_vector) |
find:deriv | rolling:mean |
|
exp(instant_vector) |
math:exp |
|
floor(instant_vector) |
math:floor |
|
group(instant_vector) |
stats:alwaysone |
|
group by (labels) (instant_vector) |
group_by:alwaysone |
|
idelta(range_vector) |
rolling:delta |
aliased to delta |
increase(range_vector) |
rolling:increase |
|
irate(range_vector) |
find:counter | rolling:mean |
aliased to rate |
last_over_time(range_vector) |
rolling:last |
|
ln(instant_vector) |
math:ln |
|
log2(instant_vector) |
math:log2 |
|
log10(instant_vector) |
math:log10 |
|
max(instant_vector) |
stats:max |
|
max by (labels) (instant_vector) |
group_by:max |
|
max_over_time(range_vector) |
rolling:max |
|
min(instant_vector) |
stats:min |
|
min by (labels) (instant_vector) |
group_by:min |
|
min_over_time(range_vector) |
rolling:min |
|
or |
op:or |
|
pi |
math:pi |
|
present_over_time(range_vector) |
rolling:present |
|
quantile(n, instant_vector) |
stats:percentile |
|
quantile by (labels) (n, instant_vector) |
group_by:percentile |
|
quantile_over_time(n, range_vector) |
rolling:percentile |
|
rad(instant_vector) |
math:rad |
|
rate(range_vector) |
find:counter | rolling:mean |
|
resets(range_vector) |
rolling:resets |
|
round(instant_vector, to_nearest) |
math:round |
|
sgn(instant_vector) |
math:sgn |
|
sin, sinh(instant_vector) |
math:sin,sinh |
|
sqrt(instant_vector) |
math:sqrt |
|
stddev(instant_vector) |
stats:stddev |
|
stddev by (labels) (instant_vector) |
group_by:stddev |
|
stddev_over_time(range_vector) |
rolling:stddev |
|
stdvar(instant_vector) |
stats:popvar |
|
stdvar by (labels) (instant_vector) |
group_by:popvar |
|
stdvar_over_time(range_vector) |
rolling:popvar |
|
sum(instant_vector) |
stats:sum |
|
sum by (labels) (instant_vector) |
group_by:sum |
|
sum_over_time(range_vector) |
rolling:sum |
|
tan, tanh(instant_vector) |
math:tan,tanh |
|
time |
time:epoch |
|
topk(n, instant_vector) |
opt:fetch(numeric, average, "topk, n") |
|
Functions Not Yet Supported
The following PromQL functions are not currently available in CAQL but may be implemented in the future.
PromQL Function |
vector to vector comparison (==,!=,>,<,>=,<=) |
@ modifier |
# comment |
atan2 |
count_values(value_label, instant_vector) |
day_of_month(instant_vector) |
day_of_week(instant_vector) |
day_of_year(instant_vector) |
days_in_month(instant_vector) |
group_left |
group_right |
histogram_count(histogram_instant_vector) |
histogram_fraction(lower, upper, histogram_instant_vector) |
histogram_quantile(n, histogram_instant_vector) |
histogram_sum(histogram_instant_vector) |
holt_winters(range_vector, smoothing_factor, trend_factor) |
hour(instant_vector) |
ignoring |
label_join(instant_vector, dst_label, separator, src_label_1, src_label_2, ...) |
label_replace(instant_vector, dst_label, replacement, src_label, regex) |
minute(instant_vector) |
month(instant_vector) |
offset |
on |
predict_linear(range_vector, t) |
scalar(instant_vector) |
sort(instant_vector) |
sort_desc(instant_vector) |
subqueries |
timestamp(instant_vector) |
unless |
vector(scalar) |
without |
year(instant_vector) |