Skip to content
This repository was archived by the owner on Jun 29, 2026. It is now read-only.

feat: Add disk usage percentage and warn on high usage - #57

Merged
lfrancke merged 12 commits into
mainfrom
feat/disk-usage-percent
Apr 9, 2026
Merged

feat: Add disk usage percentage and warn on high usage#57
lfrancke merged 12 commits into
mainfrom
feat/disk-usage-percent

Conversation

@lfrancke

@lfranckelfrancke commented Mar 30, 2026

Copy link
Copy Markdown
Member

Summary

  • Add usage_percent field to disk collection output, calculated as (total - available) / total * 100
  • Log at WARN level when any disk exceeds 85% usage, making it easy to spot in Graylog/Vector

Motivated by a customer running out of space on an attached PVC over the weekend.

Test plan

  • cargo test --all-features passes
  • cargo clippy with RUSTFLAGS="-D warnings" passes

lfranckeand others added 11 commits March 30, 2026 10:45
The tracing statement for `user.gid` was reading from `user.uid`
instead of `user.gid`, causing the wrong value to be reported.
Replace `into_iter().next().is_none()` with `list().is_empty()`
for clarity, and use `list().iter()` for the actual collection.
This was likely a debugging leftover — the error source chain is
already captured via the `successors` iterator below.
JSON serialization and file write can fail at runtime (e.g. disk
full). Log the error and continue the loop instead of crashing,
since this tool may run continuously for hours.
std::thread::sleep blocks the entire tokio worker thread.
Since main is already async, use the non-blocking alternative.
In a container debugging tool, broken DNS config (/etc/resolv.conf)
is a likely scenario to diagnose. Log the error and skip DNS lookups
instead of panicking.
…andling
The network collector silently swallowed interface listing errors by
returning empty data. Now it returns Result so the orchestrator wraps
it in ComponentResult, matching the pattern used by other fallible
collectors. Errors appear in JSON output instead of being silently
lost.
HashMap produces non-deterministic JSON output, making it hard to
diff containerdebug output across runs. BTreeMap sorts keys
consistently.
Add `usage_percent` field to disk collection output. When a disk
exceeds 85% usage, log at WARN level instead of INFO so it stands
out in log aggregation systems.
@lfranckelfrancke moved this to Development: Waiting for Review in Stackable EngineeringMar 30, 2026
@lfranckelfrancke self-assigned this Mar 30, 2026
@sbernauer
sbernauer self-requested a review March 31, 2026 06:58
@sbernauersbernauer moved this from Development: Waiting for Review to Development: In Review in Stackable EngineeringMar 31, 2026
Comment threadsrc/system_information/disk.rs
@lfrancke
lfrancke requested a review from sbernauerApril 9, 2026 10:28
@lfrancke
lfrancke added this pull request to the merge queueApr 9, 2026
@lfranckelfrancke moved this from Development: In Review to Development: Done in Stackable EngineeringApr 9, 2026
Merged via the queue into main with commit aff9bfdApr 9, 2026
10 checks passed
@lfrancke
lfrancke deleted the feat/disk-usage-percent branch April 9, 2026 11:08
@lfranckelfrancke moved this from Development: Done to Done in Stackable EngineeringApr 9, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants

@lfrancke@sbernauer