Commit aff9bfd
authored
feat: Add disk usage percentage and warn on high usage (#57)
* fix: Log GID instead of UID in user GID tracing field
The tracing statement for `user.gid` was reading from `user.uid`
instead of `user.gid`, causing the wrong value to be reported.
* refactor: Use idiomatic empty check for disk collection
Replace `into_iter().next().is_none()` with `list().is_empty()`
for clarity, and use `list().iter()` for the actual collection.
* fix: Remove stale .source() call with unused result
This was likely a debugging leftover — the error source chain is
already captured via the `successors` iterator below.
* fix: Fix typo "proess" -> "process" in error message
* fix: Replace unwrap() calls with error logging in collection loop
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.
* fix: Use tokio::time::sleep instead of std::thread::sleep
std::thread::sleep blocks the entire tokio worker thread.
Since main is already async, use the non-blocking alternative.
* fix: Handle DNS resolver initialization failure gracefully
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.
* fix: Wrap network collector in ComponentResult for consistent error handling
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.
* refactor: Use BTreeMap for deterministic JSON key ordering
HashMap produces non-deterministic JSON output, making it hard to
diff containerdebug output across runs. BTreeMap sorts keys
consistently.
* feat: Add disk usage percentage and warn on high usage
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.
* Apply review suggestion1 parent 6f71d96 commit aff9bfd
1 file changed
+38
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
24 | 36 | | |
25 | 37 | | |
26 | 38 | | |
27 | | - | |
28 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
29 | 43 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
37 | 66 | | |
38 | 67 | | |
39 | 68 | | |
0 commit comments