feat(api): add memory breakdown metrics (system, vm, docker, zfs cache)#2036
feat(api): add memory breakdown metrics (system, vm, docker, zfs cache)#2036rkozyak wants to merge 2 commits into
Conversation
Exposes per-category memory breakdown metrics for system, vm, docker and zfs cache mirroring the Unraid dashboard's ram breakdown. Add four new fields to memory metrics: - zfsCache - vm - docker - system
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughAdds a cached memory breakdown service for ZFS, VM, and Docker usage, exposes those values plus computed system memory through GraphQL, and registers the new resolver and service in the metrics module. ChangesMemory Breakdown Feature
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant GraphQLClient
participant MemoryUtilizationResolver
participant MemoryBreakdownService
participant MetricsModule
MetricsModule->>MemoryBreakdownService: provide service
MetricsModule->>MemoryUtilizationResolver: provide resolver
GraphQLClient->>MemoryUtilizationResolver: query zfsCache/vm/docker/system
MemoryUtilizationResolver->>MemoryBreakdownService: getSources()
MemoryBreakdownService-->>MemoryUtilizationResolver: MemoryBreakdownSources
MemoryUtilizationResolver-->>GraphQLClient: resolved memory fields
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
Exposes additional per-category memory usage fields on the existing MemoryUtilization GraphQL type to mirror the Unraid dashboard RAM breakdown, backed by a new service that collects ZFS ARC, VM, and Docker memory usage with short-lived caching.
Changes:
- Adds
MemoryBreakdownServiceto collect ZFS ARC cache size, active VM balloon RSS, and Docker container cgroup memory usage (with caching). - Adds
MemoryUtilizationResolverto exposezfsCache,vm,docker, and computedsystemfields onMemoryUtilization. - Adds unit tests for the new resolver and service behaviors (including caching).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| api/src/unraid-api/graph/resolvers/metrics/metrics.module.ts | Registers the new memory breakdown service + resolver in the metrics GraphQL module. |
| api/src/unraid-api/graph/resolvers/info/memory/memory-utilization.resolver.ts | Adds GraphQL field resolvers for zfsCache, vm, docker, and system. |
| api/src/unraid-api/graph/resolvers/info/memory/memory-utilization.resolver.spec.ts | Unit tests for per-field passthrough and system calculation/clamping behavior. |
| api/src/unraid-api/graph/resolvers/info/memory/memory-breakdown.service.ts | Implements collection logic for ZFS/VM/Docker memory sources with a TTL cache. |
| api/src/unraid-api/graph/resolvers/info/memory/memory-breakdown.service.spec.ts | Unit tests for each source collector and cache behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2036 +/- ##
==========================================
+ Coverage 52.77% 52.85% +0.08%
==========================================
Files 1035 1037 +2
Lines 72060 72208 +148
Branches 8303 8337 +34
==========================================
+ Hits 38031 38168 +137
- Misses 33903 33914 +11
Partials 126 126 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- Prevents duplicate in flight breakdown collecitons - Declare as @fields for zfs/vm/docker/system memory
Exposes per-category memory breakdown metrics for system, vm, docker and zfs cache. Mirroring the Unraid dashboard's ram widget breakdown.
Add four new fields to memory metrics:
Summary by CodeRabbit
systemmemory calculation that reports uncategorized RAM after subtracting known sources.