Skip to content

feat(promql): presence functions absent / absent_over_time / present_over_time (#47) - #82

Merged
zzylol merged 1 commit into
mainfrom
feat/presence-functions
Jul 3, 2026
Merged

zzylol merged 1 commit into
mainfrom
feat/presence-functions

Conversation

@zzylol

@zzylol zzylol commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Closes #47. absent / absent_over_time / present_over_time parsed but were rejected (~65 corpus rejections).

How

Each lowers to a per-series Aggregate{[Absent / AbsentOverTime / PresentOverTime]} over the (instant or range) argument. The empty-result → synthesized-1-sample logic is an L4/runtime concern; L3 only marks the operation.

Modelled label-preserving so absent's output labels — which it synthesizes from the argument's equality matchers (e.g. job from {job="x"}) — survive into the schema (verified by absent_keeps_matcher_labels_for_the_synthesized_output).

  • L3: AggIntent::Absent/AbsentOverTime/PresentOverTime; requires()=TimeSeries, is_per_series()=true, float output.
  • L2 AggFunc mirror + converter mapping.
  • Front end: walk_presence + dispatch — arg 0 is the vector; walk builds a Window for the *_over_time matrix forms (→ TimeRange).

Verified

absent(up{job="prometheus"})Aggregate{Absent} over Filter{job, Scan}; absent_over_time(m[1h]) / present_over_time(m[5m]) → over TimeRange; absent(up{job="x"}) == 1 composes with the #35 scalar operand. Alerts corpus 864 → 876 lowered.

Flipped the absent GAP test → positive, dropped absent/absent_over_time from unsupported_functions_are_rejected, added conformance section P. Full suite green (29 binaries), clippy clean.

🤖 Generated with Claude Code

…over_time (#47)

`absent`/`absent_over_time`/`present_over_time` parsed but were rejected.
They now lower to presence intents (~65 corpus rejections; alerts corpus
864 → 876).

Each lowers to a per-series `Aggregate{[Absent/AbsentOverTime/
PresentOverTime]}` over the (instant or range) argument. The empty-result →
synthesized-1-sample logic is an L4/runtime concern; L3 only marks the
operation. Modelled label-preserving so `absent`'s output labels — which it
synthesizes from the argument's equality matchers (e.g. `job` from
`{job="x"}`) — survive into the schema.

- L3 AggIntent: + Absent / AbsentOverTime / PresentOverTime;
  requires()=TimeSeries, is_per_series()=true, float output.
- L2 AggFunc mirror + converter mapping.
- Front end: `walk_presence` + dispatch (arg 0 is the vector; `walk` builds a
  Window for the `*_over_time` matrix forms → TimeRange).

Composes with #35 (`absent(up{job="x"}) == 1`). Flipped the `absent` GAP test,
dropped absent/absent_over_time from `unsupported_functions_are_rejected`,
added conformance section P (+ a matcher-label-preservation test). Full suite
green; clippy clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@zzylol
zzylol merged commit 3eb1886 into main Jul 3, 2026
1 check passed
@zzylol
zzylol deleted the feat/presence-functions branch July 3, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PromQL: presence functions (absent/absent_over_time/present_over_time) unsupported

1 participant