Skip to content

perf(store): use the stats projection for counts - #1411

Closed
scttbnsn wants to merge 1 commit into
dev/v1.8from
perf/v1.8-stats-projection
Closed

scttbnsn wants to merge 1 commit into
dev/v1.8from
perf/v1.8-stats-projection

Conversation

@scttbnsn

Copy link
Copy Markdown
Contributor

DR-88. Held for 1.8.1.

The agent event summary and the stats aggregator only read counts and a few scalar fields, but called getContainers(), which clones and redacts every full row. Both now use getContainersForStats(). The projection gains name, which the aggregator needs. The aggregator's container type is narrowed to the four fields it reads.

Left alone: the Prometheus gauge rebuild in app/prometheus/container.ts. Its labels come from flatten() over result_, image_, update_kind_*, labels and trigger fields, which the projection doesn't carry, so it needs full rows.

Measured with a throwaway script, 2000 containers with large result, details, label and scan payloads, in-memory store, one call each:

before after
event summary (heap held) 62.8 MiB 0.47 MiB
event summary (time) 123 ms 1.6 ms
stats aggregator fetch (heap held) 62.7 MiB 0.47 MiB
stats aggregator fetch (time) 115 ms 1.3 ms

Output is unchanged. A store test checks the summary, image count and id/name/watcher/agent match between getContainers and getContainersForStats, and the site tests assert the projection is called and getContainers isn't.

The agent summary and the stats aggregator only read counts and a few scalar fields, but loaded and cloned every full container row. Use getContainersForStats instead and add name to the projection for the aggregator. The Prometheus gauge rebuild still reads full rows because its labels come from the result and image fields.
@vercel

vercel Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
drydock-website Ready Ready Preview Oct 19, 2026 8:23pm UTC
drydockdemo-website Ready Ready Preview Oct 19, 2026 8:23pm UTC

@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

scttbnsn added a commit that referenced this pull request Oct 20, 2026
* fix(agent): detect half-open agent event streams (#1405)

* fix(compose): fill the operation record like the Docker action (#1406)

* fix(watcher): don't hold update results for release notes (#1409)

* perf(store): use the stats projection for counts (#1411)

* fix(store): keep a retained policy with the replacement on local renames (#1412)

* fix(api): build the dependency graph from the listed containers (#1419)

* fix(agent): tell Portwing timeouts apart from unreachable agents (#1422)

* feat(api): include versions in update-operation-changed events (#1427)

* feat(notifications): show why a notification was skipped (#1429)

* docs(changelog): sort the batch B entries into their sections
@scttbnsn

Copy link
Copy Markdown
Contributor Author

Landed in #1433 as part of folding the reviewed 1.8 work into 1.8.0.

@scttbnsn scttbnsn closed this Oct 20, 2026
@scttbnsn
scttbnsn deleted the perf/v1.8-stats-projection branch October 20, 2026 13:28

This branch was successfully deployed

2 active deployments
Preview – drydockdemo-website — 1ed39d11 Deployed Oct 19, 2026 by vercel[bot]
Preview – drydock-website — 1ed39d11 Deployed Oct 19, 2026 by vercel[bot]
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.

1 participant