You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MetricsQL: rate/increase/delta/changes use Prometheus semantics instead of VictoriaMetrics #653
The MetricsQL frontend maps rate, increase, delta and changes to the same AggIntents as PromQL. VictoriaMetrics computes them differently:
it uses the last sample before the window;
it does not extrapolate.
So with a sparse counter, increase(m[5m]) is evaluated with Prometheus semantics and can differ from VictoriaMetrics. The query is accepted silently. This behavior predates the unified lowering: it was copied from the legacy MetricsQL frontend.
Why it is not rejected now
Rejecting these functions would break the MetricsQL golden tests (crates/frontend-metricsql/tests/lowering.rs, victoriametrics_go_golden.rs).
Follow-up
Add MetricsQL-specific intents, or a semantics flag on the existing ones, and evaluate them as VictoriaMetrics does. Until then, either reject the functions or document the difference.
One more from the #540 re-review: constant scalar arithmetic such as 2*3 or up + (2*3) is rejected with "scalar root requires lower_metricsql_query", even when the caller already uses that function. Nothing wrong is computed, but the error points at the wrong cause. The parser keeps 2*3 as a BinaryOperator; only a bare NumberLiteral (and (5), -5, which the parser folds) is treated as a scalar. A fix is to constant-fold number-only binary expressions before those checks, as PromQL does.
Activity
zzylol commentedon Oct 12, 2026
One more from the #540 re-review: constant scalar arithmetic such as
2*3orup + (2*3)is rejected with "scalar root requires lower_metricsql_query", even when the caller already uses that function. Nothing wrong is computed, but the error points at the wrong cause. The parser keeps2*3as aBinaryOperator; only a bareNumberLiteral(and(5),-5, which the parser folds) is treated as a scalar. A fix is to constant-fold number-only binary expressions before those checks, as PromQL does.