Summary
promql-parser 0.9.0 rejects several PromQL functions that exist in Prometheus's current promql/parser/functions.go as unknown function. All are marked Experimental: true upstream, so they appear to be additions made after the 0.9 function table was last synced.
I found these by running Prometheus's own engine test corpus through promql-parser 0.9: I extracted every eval expression from promql/promqltest/testdata/*.test (1823 deduped expressions) and parsed each. 316 fail to parse; the unknown-function failures cluster in functions.test, info.test, and histograms.test.
Functions in Prometheus main but not in promql-parser 0.9
Diff of the two function tables (Prometheus 87 vs promql-parser 76):
| Function |
ArgTypes |
Variadic |
Returns |
Experimental |
mad_over_time |
(matrix) |
— |
vector |
yes |
first_over_time |
(matrix) |
— |
vector |
yes |
ts_of_first_over_time |
(matrix) |
— |
vector |
yes |
ts_of_last_over_time |
(matrix) |
— |
vector |
yes |
ts_of_max_over_time |
(matrix) |
— |
vector |
yes |
ts_of_min_over_time |
(matrix) |
— |
vector |
yes |
histogram_quantiles |
(vector, string, scalar, scalar…) |
9 |
vector |
yes |
info |
(vector, vector) |
1 |
vector |
yes |
max_of |
(scalar, scalar) |
— |
scalar |
yes |
min_of |
(scalar, scalar) |
— |
scalar |
yes |
start |
() |
— |
scalar |
yes |
end |
() |
— |
scalar |
yes |
step |
() |
— |
scalar |
yes |
range |
() |
— |
scalar |
yes |
Reproduction
use promql_parser::parser;
for q in [
"mad_over_time(metric[5m])",
"info(metric, {k=\"v\"})",
"histogram_quantiles(metric, \"q\", 0.5, 0.9)",
"ts_of_max_over_time(metric[5m])",
"max_of(scalar(a), scalar(b))",
] {
assert!(parser::parse(q).is_err(), "{q} unexpectedly parsed");
}
(promql-parser = "0.9.0")
Happy to send a PR adding the missing function-table entries if that's helpful.
Summary
promql-parser0.9.0 rejects several PromQL functions that exist in Prometheus's currentpromql/parser/functions.goasunknown function. All are markedExperimental: trueupstream, so they appear to be additions made after the 0.9 function table was last synced.I found these by running Prometheus's own engine test corpus through
promql-parser0.9: I extracted everyevalexpression frompromql/promqltest/testdata/*.test(1823 deduped expressions) and parsed each. 316 fail to parse; the unknown-function failures cluster infunctions.test,info.test, andhistograms.test.Functions in Prometheus
mainbut not inpromql-parser0.9Diff of the two function tables (Prometheus 87 vs promql-parser 76):
mad_over_timefirst_over_timets_of_first_over_timets_of_last_over_timets_of_max_over_timets_of_min_over_timehistogram_quantilesinfomax_ofmin_ofstartendsteprangeReproduction
(promql-parser = "0.9.0")
Happy to send a PR adding the missing function-table entries if that's helpful.