Skip to content

feat(monitoring): disk usage history by category, with image and build cache cleanup - #69

Merged
agentHits merged 1 commit into
AgentHits-Devfrom
claude-test/disk-monitoring-image-cleanup-504338
Oct 13, 2026
Merged

agentHits merged 1 commit into
AgentHits-Devfrom
claude-test/disk-monitoring-image-cleanup-504338

Conversation

@agentHits

Copy link
Copy Markdown
Owner

What changes

Disk Space card on the Monitoring page. It now answers two questions the old card could not: what takes the disk, and what filled it over a period.

  • The used space is split into images, build cache, volumes, container logs, container files, Dokploy data, swap files and "System and other". The rows add up to the used space.
  • A stacked bar chart covers 1, 3, 7 or 30 days. Each bar is the fullest moment of its interval, so a short spike stays visible.
  • A table gives the change of every category over the period, and a list names the images, volumes and containers that grew or shrank the most.
  • The "Free up space" block from the update dialog is also in this card. It lists the old Dokploy builds it removes and can clear the build cache.

Background sampling. The history is collected by the panel process, not by an open page:

What How often
Used space (statfs) every minute
Images, container files, build cache (Engine API) every 5 minutes
Volumes, container logs, Dokploy data, swap files every hour
All of the above at once when the used space moves by 0.5% of the disk (at least 256 MiB)

A probe never takes more than 2% of the time: after a slow one the sampler waits fifty times its duration. Samples are kept for 30 days as JSON lines in monitoring/disk-history/.

Why the two cards disagreed

  • The old card counted in GiB and labelled the result GB; Docker prints decimal GB. The new card uses decimal units everywhere.
  • Docker's total does not include swap files, the operating system, system logs, container logs or Docker's own metadata. They are separate rows now.
  • Docker's build cache total counts the records that images share a second time. The new card leaves them out of the build cache row.

Notes for review

  • Docker is asked through the Engine API (GET /system/df with a type filter), so no docker CLI process delays the cleanup commands that wait for Docker to be idle.
  • Container logs are under Docker's root directory, which the panel's container does not see. A throwaway busybox container with that directory mounted read-only measures them once an hour. If it cannot run, the logs stay in "System and other".
  • settings.getDiskUsageHistory is an admin procedure, classified "read".
  • UpdateDiskSpace gained oldImages; freeUpdateDiskSpace samples the disk after a cleanup so the card shows the freed space at once.
  • The Docker disk usage pie takes the colours of the same categories in the new card. The palette was checked with a colour-blind-safety validator on the light and dark surfaces.
  • The live disk chart docker-disk-chart.tsx is removed; the new card replaces it.

Testing

  • New unit tests: probes (disk-usage.test.ts), sampler, storage and query (disk-history.test.ts), formatting and axes (disk-usage-format.test.ts).
  • bun run typecheck passes for all workspaces.
  • Full suite locally: 3480 passed, 2 failed. Both failures are unrelated to this change: application.real.test.ts needs swarm and timed out, and acme-delete-docker.test.ts failed once under that load and passes when run alone.
  • The probes and the history were run against a real Docker 29.8 daemon (containerd image store), and the /system/df answer was checked on a Docker 29.4 daemon with the overlay2 driver.
  • The card was rendered with fixture data in the dark and light themes and at 390 px width.

Not tested: the card inside a running panel with real history. That needs a deployed build.

🤖 Generated with Claude Code

…d cache cleanup on the Monitoring page

The Disk Space card on the Monitoring page showed one number and a chart
of the last few minutes, recorded only while the page was open. It could
not answer what filled the disk over a day or a week, and its number did
not match the Docker disk usage card under it.

History. The panel now samples the disk in the background: the used
space every minute, Docker's image, container and build cache sizes
every five minutes, and once an hour the parts that need a walk over
files (volumes, container logs, Dokploy's own data, swap files). When the
used space moves by 0.5% of the disk (at least 256 MiB) since the last
saved sample, the next sample is taken on that minute, so a short spike
is recorded with its breakdown. A probe never takes more than 2% of the
time: after a slow one the sampler waits fifty times its duration.
Samples are kept for 30 days as JSON lines under the monitoring
directory; "Clean Monitoring" removes them with the rest.

Docker is asked through the Engine API, so no docker CLI process holds
up the cleanup commands that wait for Docker to be idle. Container logs
live under Docker's root directory, which the panel's container does not
see; a throwaway busybox container with that directory mounted read-only
measures them. When it cannot run, the logs stay in "System and other".

Card. It shows the used space split into images, build cache, volumes,
container logs, container files, Dokploy data, swap files and "System
and other", and the rows add up to the used space. A stacked bar chart
covers 1, 3, 7 or 30 days; each bar is the fullest moment of its
interval. A table gives the change of every category over the period,
and a list names the images, volumes and containers that grew or shrank
the most. Sizes are in decimal units, as Docker prints them; the old
card counted in GiB and labelled the result GB, which is one reason the
two cards disagreed. Build cache is counted without the records that
images share, which Docker's total counts twice.

Cleanup. The block that removes old Dokploy images and, on request, the
build cache was reachable only from the update dialog. It is now also in
the Disk Space card, where it lists the builds it removes. After a
cleanup the disk is sampled at once, so the card shows the freed space.

The Docker disk usage chart takes the colours of the same categories in
the new card.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@agentHits
agentHits merged commit cff825f into AgentHits-Dev Oct 13, 2026
9 of 10 checks passed
@agentHits
agentHits deleted the claude-test/disk-monitoring-image-cleanup-504338 branch October 13, 2026 17:15
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