Skip to content

deprecation: remove labels marked as to be deprecated - #2021

Merged
hami-robot[bot] merged 3 commits into
Project-HAMi:masterfrom
FouoF:deprecate
Jul 8, 2026
Merged

deprecation: remove labels marked as to be deprecated#2021
hami-robot[bot] merged 3 commits into
Project-HAMi:masterfrom
FouoF:deprecate

Conversation

@FouoF

@FouoF FouoF commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind deprecation

What this PR does / why we need it:

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Summary by CodeRabbit

  • Documentation
    • Updated the Prometheus help text for container device memory metrics to be shorter and clearer.
  • Bug Fixes
    • Adjusted container device memory metrics so the non-legacy metric now uses a reduced label set (removing several detailed labels), while the legacy metric continues to include the prior detailed labeling.

Signed-off-by: Jifei Wang <jifei.wang@dynamia.ai>
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d97f6c24-874f-40c7-8ac2-2565232a3068

📥 Commits

Reviewing files that changed from the base of the PR and between 43ab747 and d0fccfa.

📒 Files selected for processing (1)
  • cmd/vGPUmonitor/metrics.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • cmd/vGPUmonitor/metrics.go

📝 Walkthrough

Walkthrough

The pull request shortens the hami_container_device_memory_bytes descriptor help text and reduces its label set to base container labels. The collector now emits the non-legacy metric with those labels only, while the detailed breakdown remains on the legacy metric.

Changes

Device Memory Metric Label Change

Layer / File(s) Summary
Update metric descriptor
cmd/vGPUmonitor/metrics.go
The ctrDeviceMemorydesc descriptor now uses a shorter help string and only the base labels: namespace, pod, container, vdevice_index, and device_uuid.
Split non-legacy and legacy emission
cmd/vGPUmonitor/metrics.go
collectContainerMetrics emits memoryTotal for the non-legacy metric with base labels only, then computes the detailed labels for the legacy metric.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I nibbled labels, neat and small,
The metric still reports them all.
One path is brief, one path is wide,
With rabbit hops in byte-filled stride. 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: removing deprecated labels from the metric definition.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request simplifies the ctrDeviceMemorydesc Prometheus metric by removing deprecated labels. However, this change introduces a critical runtime error because the metric collection code still passes the old label array with nine elements instead of the updated five-element array, which will cause the Prometheus client to fail. This mismatch needs to be resolved by updating the arguments passed to the metric sender.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread cmd/vGPUmonitor/metrics.go Outdated
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 59.52% <ø> (ø)

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

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

Comment thread cmd/vGPUmonitor/metrics.go
Signed-off-by: Jifei Wang <jifei.wang@dynamia.ai>
@hami-robot hami-robot Bot added size/S and removed size/XS labels Jul 7, 2026

@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.

🧹 Nitpick comments (1)
cmd/vGPUmonitor/metrics.go (1)

111-114: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Help text still says "breakdown" but labels no longer carry breakdown detail.

The descriptor's label set was reduced to base container labels (no context/module/buffer/offset), so this metric now reports only a total value, not a breakdown. The help string Container device memory usage breakdown in bytes is misleading for consumers reading /metrics output; the actual breakdown now only exists on the legacy metric.

💡 Suggested wording fix
 	ctrDeviceMemorydesc = prometheus.NewDesc(
 		"hami_container_device_memory_bytes",
-		`Container device memory usage breakdown in bytes`,
+		`Container device memory usage in bytes`,
 		[]string{"namespace", "pod", "container", "vdevice_index", "device_uuid"}, nil,
🤖 Prompt for 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.

In `@cmd/vGPUmonitor/metrics.go` around lines 111 - 114, The help text for the
metric descriptor in ctrDeviceMemorydesc is misleading because the label set now
only exposes base container labels and no longer represents a breakdown. Update
the prometheus.NewDesc help string to describe the metric as a total device
memory usage value rather than a breakdown, keeping the labels and behavior in
sync with what /metrics actually exposes.
🤖 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.

Nitpick comments:
In `@cmd/vGPUmonitor/metrics.go`:
- Around line 111-114: The help text for the metric descriptor in
ctrDeviceMemorydesc is misleading because the label set now only exposes base
container labels and no longer represents a breakdown. Update the
prometheus.NewDesc help string to describe the metric as a total device memory
usage value rather than a breakdown, keeping the labels and behavior in sync
with what /metrics actually exposes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5163f09e-3dca-4a83-8e63-584f3ef52a69

📥 Commits

Reviewing files that changed from the base of the PR and between 34b60c0 and 43ab747.

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

@mesutoezdil

Copy link
Copy Markdown
Contributor

the help text still says "breakdown in bytes" but the breakdown labels are gone now.
should this just be "usage in bytes"?

Signed-off-by: Jifei Wang <jifei.wang@dynamia.ai>
@mesutoezdil

Copy link
Copy Markdown
Contributor

/lgtm

@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 Jul 8, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: archlitchi, FouoF

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

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.

3 participants