Skip to content

fix(vGPUmonitor): skip uninitialized short UUIDs instead of exit - #2364

Merged
archlitchi merged 1 commit into
Project-HAMi:masterfrom
SK8-infi:fix-vgpumonitor-uuid
Aug 6, 2026
Merged

fix(vGPUmonitor): skip uninitialized short UUIDs instead of exit#2364
archlitchi merged 1 commit into
Project-HAMi:masterfrom
SK8-infi:fix-vgpumonitor-uuid

Conversation

@SK8-infi

@SK8-infi SK8-infi commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

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

image

disclosure: Antigravity was used to audit the file.

Summary by CodeRabbit

  • Bug Fixes
    • Container metrics collection now continues when a device has an invalid UUID.
    • Invalid devices are skipped with a warning, allowing metrics for other devices to be collected normally.

…metric collection

Signed-off-by: SK8-infi <shivansh.katiyar1712@gmail.com>
@hami-robot hami-robot Bot added kind/bug Something isn't working dco-signoff: yes labels Aug 4, 2026
@hami-robot hami-robot Bot added the size/XS label Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The vGPU monitor now logs a warning and skips devices with invalid UUID lengths. Metric collection continues for subsequent devices and containers.

Changes

vGPU metric collection

Layer / File(s) Summary
Skip invalid device UUIDs
cmd/vGPUmonitor/metrics.go
Invalid UUID lengths now produce a warning and skip the affected device instead of terminating container metric collection.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested reviewers: mesutoezdil

Poem

A rabbit found a UUID askew,
It warned, then skipped the faulty queue.
The next GPUs still report,
Metrics reach the monitoring port.
No scrape is lost from view.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The change satisfies issue #2302 by skipping invalid short UUIDs and allowing metric collection to continue.
Out of Scope Changes check ✅ Passed The changes are limited to UUID handling in vGPUmonitor metric collection and match the linked issue scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: skipping uninitialized short UUIDs during vGPUmonitor collection.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai
coderabbitai Bot requested a review from mesutoezdil August 4, 2026 19:25

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2cabe29 and cc972f9.

📒 Files selected for processing (1)
  • cmd/vGPUmonitor/metrics.go

Comment thread cmd/vGPUmonitor/metrics.go
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/vGPUmonitor/metrics.go 0.00% 1 Missing ⚠️
Flag Coverage Δ
unittests 61.01% <0.00%> (+0.24%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cmd/vGPUmonitor/metrics.go 0.00% <0.00%> (ø)

... and 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SK8-infi

SK8-infi commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

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)

@archlitchi archlitchi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@hami-robot

hami-robot Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hami-robot hami-robot Bot added the approved label Aug 6, 2026
@archlitchi
archlitchi merged commit e95ea4c into Project-HAMi:master Aug 6, 2026
17 of 19 checks passed
imantaba added a commit to imantaba/HAMi that referenced this pull request Aug 6, 2026
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>
hami-robot Bot pushed a commit that referenced this pull request Aug 6, 2026
#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(vGPUmonitor): premature return on short UUID drops metrics for remaining GPUs/containers

2 participants