Skip to content

fix(chart): keep workload labels on scraped HAMi metrics - #2934

Open
mesutoezdil wants to merge 1 commit into
Project-HAMi:masterfrom
mesutoezdil:fix/servicemonitor-honor-labels
Open

fix(chart): keep workload labels on scraped HAMi metrics#2934
mesutoezdil wants to merge 1 commit into
Project-HAMi:masterfrom
mesutoezdil:fix/servicemonitor-honor-labels

Conversation

@mesutoezdil

@mesutoezdil mesutoezdil commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Nine vGPUmonitor metrics and two scheduler metrics carry namespace, pod and container labels naming the GPU workload, but the Prometheus Operator sets those same three names as target labels for every ServiceMonitor endpoint and both endpoints left honorLabels unset, so Prometheus overwrites them with the scrape target and moves the workload values to exported_namespace, exported_pod and exported_container. Every series then reports the vgpu-monitor pod rather than the workload, and the dashboard namespace variable only ever offers the namespace HAMi itself runs in, so set honorLabels on both endpoints.

Does this PR introduce a user-facing change? The device plugin and scheduler ServiceMonitors now set honorLabels, so the namespace, pod and container labels on HAMi metrics keep identifying the GPU workload instead of being replaced by the scrape target. A Prometheus resource with overrideHonorLabels enabled still forces them back.

@hami-robot

hami-robot Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mesutoezdil
Once this PR has been reviewed and has the lgtm label, please assign dsfans2014 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@mesutoezdil

Copy link
Copy Markdown
Contributor Author

/kind bug

@hami-robot hami-robot Bot added the kind/bug Something isn't working label Sep 1, 2026
@coderabbitai

coderabbitai Bot commented Sep 1, 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: Team

Run ID: 51f6878d-cdba-4ca0-b579-58df319aae09

📥 Commits

Reviewing files that changed from the base of the PR and between e6932f5 and ae918f0.

📒 Files selected for processing (2)
  • charts/hami/templates/device-plugin/servicemonitor.yaml
  • charts/hami/templates/scheduler/servicemonitor.yaml

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The Helm chart now sets honorLabels: true on the device-plugin and scheduler ServiceMonitor metrics endpoints. Prometheus preserves labels provided by scraped targets.

Changes

Metrics label preservation

Layer / File(s) Summary
ServiceMonitor endpoint configuration
charts/hami/templates/device-plugin/servicemonitor.yaml, charts/hami/templates/scheduler/servicemonitor.yaml
Both metrics endpoints set honorLabels: true, so Prometheus preserves labels from scraped targets.

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

Merge Risk: ⚪ Minimal · up to ae918

This localized chart change preserves workload labels on HAMi metrics without introducing an actionable merge-blocking risk; it is merge-ready after normal checks and review.

Suggested reviewers: archlitchi, dsfans2014

Poem

A rabbit checks the metrics stream
Labels stay true, just as they seem
Two monitors now guard the trail
Prometheus keeps each offered detail
The chart grows wise, precise, and neat

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving workload labels on scraped HAMi metrics through chart updates.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 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.

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 70.86% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes

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

Nine vGPUmonitor metrics and two scheduler metrics carry namespace, pod
and container labels naming the GPU workload. The Prometheus Operator
sets those same three names as target labels for every ServiceMonitor
endpoint, and both endpoints left honorLabels unset, which renders as
honor_labels: false. Prometheus then overwrites the bare names with the
scrape target and moves the workload values to exported_namespace,
exported_pod and exported_container.

The result is that every series reports the vgpu-monitor pod instead of
the workload, and the dashboard namespace variable, which reads
label_values(hami_vgpu_memory_used_bytes, namespace), only ever offers
the namespace HAMi itself runs in. Set honorLabels on both endpoints so
the exposed labels win.

Note that a Prometheus resource with overrideHonorLabels enabled forces
honor_labels back to false for every scrape config it generates.

Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant