Repository navigation
feat: add hami_gpu_device_health metric to scheduler #2617
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 health live at scrape time or a cached value?
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 a cached value from the scheduler's in-memory device list, same as the other metrics in collectNodeMetrics
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. if a node has zero devices in devicelists, does this metric emit anything for that node at all?
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. nothing gets emitted in that case, the loop just doesn't run — same behavior as the existing MIG metric |
||
| 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. 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.
yeah it's intentional — Health is set on all device types, the name reflects what the metric measures rather than which backend it's coming from