feat: sum aggregate rows across backends on event-counts and /reports #8

Merged
benvin merged 1 commits from benvin/aggregate-sums into main 2026-09-05 13:06:44 +10:00
Member

Why

Puppetboard's node-status numbers and daily-reports chart are wrong: each PuppetDB
counts only its own slice, and pdbmux passed both partial rows through instead of
adding them. PR #5 left aggregates un-summed on purpose; this closes that gap.

How

  • Sum /event-counts per subject and /aggregate-event-counts per summary object across backends.
  • Sum extract/count()/group_by rows on /reports, grouping on the query's plain extract fields plus its group_by clause; a query with no function column stays on the union path.
  • Absent or non-numeric aggregate columns are skipped rather than zeroed, and a key only one backend reported passes through byte-for-byte.
  • include_total on a summed endpoint reports the merged row count, not the sum of the backends' X-Records.
## Why Puppetboard's node-status numbers and daily-reports chart are wrong: each PuppetDB counts only its own slice, and pdbmux passed both partial rows through instead of adding them. PR #5 left aggregates un-summed on purpose; this closes that gap. ## How - Sum `/event-counts` per subject and `/aggregate-event-counts` per summary object across backends. - Sum `extract`/`count()`/`group_by` rows on `/reports`, grouping on the query's plain extract fields plus its `group_by` clause; a query with no `function` column stays on the union path. - Absent or non-numeric aggregate columns are skipped rather than zeroed, and a key only one backend reported passes through byte-for-byte. - `include_total` on a summed endpoint reports the merged row count, not the sum of the backends' `X-Records`.
unkin-agent added 1 commit 2026-09-05 12:30:24 +10:00
feat: sum aggregate rows across backends on event-counts and /reports
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
b1ecbf31ac
- group by the row's non-aggregate fields and add the numeric columns; X-Records on a summed endpoint is the merged row count
unkin-agent force-pushed benvin/aggregate-sums from b7dc2a53a2 to b1ecbf31ac 2026-09-05 12:30:24 +10:00 Compare
benvin merged commit d724cf0a5e into main 2026-09-05 13:06:44 +10:00
benvin deleted branch benvin/aggregate-sums 2026-09-05 13:06:44 +10:00
Sign in to join this conversation.