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
Add a semantic-equivalent rewrite for PromQL avg_over_time that exposes mergeable sum and count work, then divides them to preserve the original result.
The existing grouped avg rewrite follows this algebra:
avg(x) → float(sum(x)) / count(*)
avg_over_time(x[5m]) is lowered as a Reduction::PerEntity aggregate over the range. It is currently excluded from the rewrite:
After the per-entity multi-measure/schema capability is available, implement the analogous range rewrite while preserving PromQL series identity, labels, timestamps, output name, Float64 type, and null/denominator semantics. The rewrite should make the sum and count portions independently available to existing reuse/realization strategies and return exactly the same observable result as avg_over_time.
Acceptance criteria
Eligible avg_over_time expressions produce a semantic-equivalent sum/count/divide rewrite candidate.
The rewritten result preserves input-series identity, labels, timestamps, output name, and Float64 output schema.
The rewrite is not offered when it could change null or denominator semantics.
Tests demonstrate equivalence for a representative range query and confirm that the rewrite exposes reusable sum and count work.
Activity