-
Notifications
You must be signed in to change notification settings - Fork 793
feat(monitor): add node label to host GPU metrics #2398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
ipsitapp8
wants to merge
4
commits into
Project-HAMi:master
from
ipsitapp8:add-node-label-to-monitor
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2c079b8
feat(monitor): add node label to host GPU metrics
ipsitapp8 20589a5
test: track whether host metrics are found during validation
ipsitapp8 7d8c911
fix(monitor): rename node label to node_name on host GPU metrics
ipsitapp8 e205fb5
test(monitor): cover legacy and unset-NODE_NAME cases for host metrics
ipsitapp8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
collectpodandcontainerinfo errors out when node_name is empty. this one falls back to unknown instead. why not do the same here, for consistency?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch on the inconsistency, it's intentional, because the two functions use
NODE_NAMEfor different things.In
collectPodAndContainerInfothe node name is a functional input: it's the selector passed to the pod lister (metrics.go:374). With an empty value the lister would match pods whose assigned-node annotation is empty, i.e. silently wrong data. Erroring out is the only correct behavior there.In
collectGPUInfothe node name is only a label value. The underlying NVML reads don't depend on it at all. SinceCollectjust logs the error and moves on (metrics.go:221-224), returning an error would mean an unsetNODE_NAMEdropshami_host_gpu_memory_used_bytesandhami_host_gpu_utilization_ratiofrom every scrape, metrics that work fine today without any node dependency. That would turn a label-only, backward-compatible change into a regression for anyone deploying vGPUmonitor outside the Helm chart (the chart does injectNODE_NAMEindaemonsetnvidia.yaml, but manual/vendored manifests exist).I also chose the literal
"unknown"over an empty string on purpose: Prometheus treats an empty label value as absent, soon(node_name)joins would fail in a confusing way, whereasnode_name="unknown"keeps the series shape stable and makes the misconfiguration visible in a query. This matches the existing precedent inpkg/version/version.go, where unset build metadata is exposed as"unknown"onhami_build_info.The warning log at
metrics.go:244surfaces the misconfiguration, andTestHostMetricsIncludeNodeLabelcovers the unset case for both the new and legacy descriptors.If you'd rather have strict consistency and prefer that host metrics disappear when
NODE_NAMEisn't set, I'm happy to flip it.