Skip to content

feat(dashboards): add importable Grafana dashboard for HAMi GPU metrics - #2301

Merged
hami-robot[bot] merged 2 commits into
Project-HAMi:masterfrom
imantaba:feat/grafana-dashboard
Aug 6, 2026
Merged

feat(dashboards): add importable Grafana dashboard for HAMi GPU metrics#2301
hami-robot[bot] merged 2 commits into
Project-HAMi:masterfrom
imantaba:feat/grafana-dashboard

Conversation

@imantaba

@imantaba imantaba commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What

The README points to a "pre-built Grafana dashboard" for GPU monitoring, but the repo only shipped a screenshot (imgs/hami-vgpu-metrics-dashboard.png) — there was no JSON to import. This adds dashboards/hami-vgpu-dashboard.json plus a README with import steps and a metric reference.

Details

  • Built on the metrics currently exported by the scheduler and the vGPU monitor (the hami_* names).
  • Templated datasource variable + node/namespace template vars, so it is portable across clusters and not pinned to a specific Prometheus UID.
  • Panels grouped into: cluster overview → physical host GPUs → scheduler allocation → per-container vGPU workloads.
  • Percent panels use green/amber/red thresholds at 75%/90%; no dual-axis panels.
  • Links the new dashboards/ directory from the README.

Testing

Validated the JSON conforms to Grafana's import schema (unique panel ids, complete panel/target fields, no gridPos overlaps). Every PromQL expression was checked against the metric names and label sets in cmd/scheduler/metrics.go and cmd/vGPUmonitor/metrics.go.

Does this PR introduce a user-facing change?

Add an importable Grafana dashboard (dashboards/hami-vgpu-dashboard.json) for HAMi GPU metrics, with import instructions and a metric reference.

This change was prepared with AI assistance (per CONTRIBUTING.md); all changes were reviewed and verified by me.

Summary by CodeRabbit

  • New Features

    • Added a Grafana dashboard for monitoring HAMi vGPU capacity, allocation, utilization, memory, and container usage.
    • Included node and namespace filtering, top memory consumers, automatic 30-second refreshes, and a six-hour default view.
  • Documentation

    • Added setup and import instructions, dashboard variable guidance, and details about covered metrics.
    • Updated monitoring documentation with a direct link to the dashboard resources.

The repo referenced a Grafana dashboard for GPU monitoring but only shipped
a screenshot (imgs/hami-vgpu-metrics-dashboard.png); there was no JSON users
could import. Add dashboards/hami-vgpu-dashboard.json built on the metrics
currently exported by the scheduler and the vGPU monitor, plus a README with
import steps and a metric reference.

The dashboard uses a templated datasource variable and node/namespace
template variables so it is portable across clusters and not tied to a
specific Prometheus UID. Panels are grouped into cluster overview, physical
host GPUs, scheduler allocation, and per-container vGPU workloads. Percent
panels use green/amber/red thresholds at 75%/90%; no dual-axis panels.

Link the new dashboards directory from the README.

Signed-off-by: imantaba <itn.taba@gmail.com>
@hami-robot
hami-robot Bot requested review from DSFans2014 and mesutoezdil August 3, 2026 12:56
@github-actions github-actions Bot added the kind/feature new function label Aug 3, 2026
@hami-robot hami-robot Bot added the size/XL label Aug 3, 2026
@coderabbitai

coderabbitai Bot commented Aug 3, 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: d8aae394-f807-45c6-9a3f-9aa90945d0f8

📥 Commits

Reviewing files that changed from the base of the PR and between 3bbae53 and f77dad1.

📒 Files selected for processing (1)
  • dashboards/hami-vgpu-dashboard.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • dashboards/hami-vgpu-dashboard.json

📝 Walkthrough

Walkthrough

The PR adds a HAMi Grafana dashboard with cluster, host, scheduler, and vGPU workload panels. It documents Prometheus requirements, variables, metrics, and import steps. The main README now links directly to the dashboards/ directory.

Changes

HAMi Grafana dashboard

Layer / File(s) Summary
Dashboard definition and usage
README.md, dashboards/README.md, dashboards/hami-vgpu-dashboard.json
Documents dashboard setup, metrics, variables, scaling behavior, refresh settings, and default time range.
Cluster and host monitoring panels
dashboards/hami-vgpu-dashboard.json
Adds cluster capacity statistics and host GPU memory and utilization charts.
Allocation and workload monitoring panels
dashboards/hami-vgpu-dashboard.json
Adds scheduler allocation, GPU sharing, per-container vGPU usage, and top-memory workload panels.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant Grafana
  participant Prometheus
  Operator->>Grafana: Select datasource, node, and namespace
  Grafana->>Prometheus: Query HAMi vGPU metrics
  Prometheus-->>Grafana: Return metric data
  Grafana-->>Operator: Render dashboard panels
Loading

Possibly related PRs

Suggested reviewers: dsfans2014

Poem

A rabbit hops through metrics bright,
Grafana charts the GPUs right.
Prometheus sends each measured byte,
Nodes and workloads come to light.
“Binky!” says the dashboard sprite.

🚥 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 clearly and concisely describes the main change: adding an importable Grafana dashboard for HAMi GPU metrics.
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

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 Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 61.72% <ø> (+0.95%) ⬆️

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

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

@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 `@dashboards/hami-vgpu-dashboard.json`:
- Around line 240-329: Update the Prometheus expressions for the panels titled
“Host GPU memory used” and “Host GPU utilization” to filter by the selected
$node through a node-aware join on the shared device_uuid label, using
hami_gpu_memory_limit_bytes as the node source. Preserve the existing host
metrics and legends, and validate the joined queries against a live scrape
before merging.
🪄 Autofix (Beta)

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: efa0eef6-0df6-47c1-a0a0-c6d900f8bb2e

📥 Commits

Reviewing files that changed from the base of the PR and between 0345bd8 and 3bbae53.

📒 Files selected for processing (3)
  • README.md
  • dashboards/README.md
  • dashboards/hami-vgpu-dashboard.json

Comment thread dashboards/hami-vgpu-dashboard.json
Comment thread dashboards/hami-vgpu-dashboard.json Outdated
Comment thread dashboards/hami-vgpu-dashboard.json Outdated
The host GPU panels queried hami_host_gpu_memory_used_bytes and
hami_host_gpu_utilization_ratio directly. Those metrics come from the vGPU
monitor and carry no node label, so the $node template variable had no
effect on them.

Filter both through 'and on (device_uuid) hami_gpu_memory_limit_bytes{node=~"$node"}':
the scheduler metric supplies the node to device_uuid mapping, so the host
panels now scope to the selected node. With All selected the match is a
no-op, preserving the previous cluster-wide view.

Signed-off-by: imantaba <itn.taba@gmail.com>
@imantaba

imantaba commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@mesutoezdil
Fixed in f77dad1 .
Filtered through and on (device_uuid) hami_gpu_memory_limit_bytes{node=~"$node"} so $node now scopes this panel .

@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, imantaba

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
@hami-robot
hami-robot Bot merged commit 96207fc into Project-HAMi:master Aug 6, 2026
15 checks passed
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