-
Notifications
You must be signed in to change notification settings - Fork 791
feat: add hami_gpu_device_health metric to scheduler #2540
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -144,6 +144,11 @@ func (cc ClusterManagerCollector) collectNodeMetrics(ch chan<- prometheus.Metric | |
| "Realized MIG instance identity and scheduler placement", | ||
| []string{"node", "device_uuid", "device_index", "mig_uuid", "profile", "gpu_instance_id", "compute_instance_id", "placement_start", "placement_size"}, nil, | ||
| ) | ||
| nodeGPUDeviceHealthDesc := prometheus.NewDesc( | ||
| "hami_gpu_device_health", | ||
| "GPU device health status (1=healthy, 0=unhealthy)", | ||
| []string{"node", "device_uuid", "device_index", "device_type"}, nil, | ||
| ) | ||
|
|
||
| // Legacy metric descriptors (only created when legacy mode is enabled) | ||
| var ( | ||
|
|
@@ -266,6 +271,16 @@ func (cc ClusterManagerCollector) collectNodeMetrics(ch chan<- prometheus.Metric | |
| } | ||
| } | ||
|
|
||
| healthVal := float64(0) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this health value live at scrape time, or a cached value from an older check? matters for alert delay if someone pages off this metric.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's the value from the most recent CheckHealth() call, written into DeviceUsage.Health by the device plugin and cached in nodeManager. so it reflects last known state, not a live poll at scrape time — lag depends on the device plugin's check interval. happy to add a note to the metric description if that's useful. |
||
| if devs.Device.Health { | ||
| healthVal = 1 | ||
| } | ||
| if err := sendMetric(ch, nodeGPUDeviceHealthDesc, prometheus.GaugeValue, | ||
| healthVal, nodeID, devs.Device.ID, fmt.Sprint(devs.Device.Index), devs.Device.Type, | ||
| ); err != nil { | ||
| klog.V(4).Infof("Failed to send nodeGPUDeviceHealthDesc metric: %v", err) | ||
| } | ||
|
|
||
| if legacy { | ||
| sendLegacyMetric(ch, legacyMemoryLimitDesc, prometheus.GaugeValue, mibToBytes(devs.Device.Totalmem), nodeID, devs.Device.ID, fmt.Sprint(devs.Device.Index), devs.Device.Type) | ||
| sendLegacyMetric(ch, legacyCoreLimitDesc, prometheus.GaugeValue, float64(devs.Device.Totalcore), nodeID, devs.Device.ID, fmt.Sprint(devs.Device.Index), devs.Device.Type) | ||
|
|
||
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.
name says gpu but this loop runs for every backend, not only gpu. same pattern as the other metrics near it. just checking this is on purpose.
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.
Yes, intentional — same pattern as hami_gpu_memory_limit_bytes, hami_gpu_core_limit_ratio, and the other descriptors in that loop. The gpu prefix follows the existing naming convention in this file rather than reflecting the backend type at runtime. The loop is backend-agnostic by design.