fix(vGPUmonitor): skip uninitialized short UUIDs instead of exit - #2364
Conversation
…metric collection Signed-off-by: SK8-infi <shivansh.katiyar1712@gmail.com>
📝 WalkthroughWalkthroughThe vGPU monitor now logs a warning and skips devices with invalid UUID lengths. Metric collection continues for subsequent devices and containers. ChangesvGPU metric collection
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested reviewers: 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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cmd/vGPUmonitor/metrics.go`:
- Around line 502-503: Update the device UUID export logic around the existing
invalid-length warning to call c.Info.IsValidUUID(i) before exporting each UUID.
Use that validity result to skip uninitialized or null device slots, rather than
relying on the fixed-width DeviceUUID(i) length; preserve exporting valid UUIDs,
including initialized values shorter than 40 bytes.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 934b3bdf-3820-433f-b186-e256272e47e3
📒 Files selected for processing (1)
cmd/vGPUmonitor/metrics.go
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 10 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
Also I see no tests for this file. Should I add tests for this file in maybe another PR(ig out of scope for this one) |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: archlitchi, SK8-infi The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Project-HAMi#2364 changed collectContainerMetrics to skip devices whose UUID is shorter than 40 chars (shared memory not yet initialised) instead of returning an error, but TestCollectContainerMetricsBadInput from Project-HAMi#2350 still asserted the old error behavior, so it fails on master. Align the short-UUID case with the actual behavior (skipped, no metrics, no error), matching the sibling TestCollectContainerMetricsSkipsInvalidUTF8UUID. Signed-off-by: imantaba <itn.taba@gmail.com>
#2364 changed collectContainerMetrics to skip devices whose UUID is shorter than 40 chars (shared memory not yet initialised) instead of returning an error, but TestCollectContainerMetricsBadInput from #2350 still asserted the old error behavior, so it fails on master. Align the short-UUID case with the actual behavior (skipped, no metrics, no error), matching the sibling TestCollectContainerMetricsSkipsInvalidUTF8UUID. Signed-off-by: imantaba <itn.taba@gmail.com>
What type of PR is this?
/kind bug
What this PR does / why we need it: In cmd/vGPUMonitor/metrics.go there is a function collectContainerMetrics during checking the correct uuid format there are two cases. One checks if the characters are less that 40 and the other check correct utf format. The utf format one throws warning and skips that device. While the other one if the chrtrs are less than 40 throws error and exits.
I think both of them should follow the same behaviour.
Which issue(s) this PR fixes:
Fixes #2302
Special notes for your reviewer: Would like to know if it was intentional or I am having an oversight
Does this PR introduce a user-facing change?: NA
disclosure: Antigravity was used to audit the file.
Summary by CodeRabbit