-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add chip label to DRM metrics
#3572
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
base: master
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -40,7 +40,7 @@ var ( | |
| drmCardInfo = prometheus.NewDesc( | ||
| prometheus.BuildFQName(namespace, drmCollectorSubsystem, "card_info"), | ||
| "Card information", | ||
| []string{"card", "memory_vendor", "power_performance_level", "unique_id", "vendor"}, nil, | ||
| []string{"card", "memory_vendor", "power_performance_level", "unique_id", "chip", "vendor"}, nil, | ||
| ) | ||
| drmGPUBusyPercent = prometheus.NewDesc( | ||
| prometheus.BuildFQName(namespace, drmCollectorSubsystem, "gpu_busy_percent"), | ||
|
|
@@ -96,6 +96,17 @@ func (c *drmCollector) Update(ch chan<- prometheus.Metric) error { | |
| return c.updateAMDCards(ch) | ||
| } | ||
|
|
||
| func chipName(s sysfs.ClassDRMCardAMDGPUStats) string { | ||
| // generate a chip name based on the deviceType and devName | ||
| cleanDevName := cleanMetricName(s.DevName) | ||
| cleanDevType := cleanMetricName(s.DevType) | ||
|
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. This should relate to https://github.com/prometheus/node_exporter/blob/master/collector/hwmon_linux.go#L517 However both parts come from different sources and will diverge. I am not sure this is something that could actually harm us, but calling it out as an issue overall. Making both implementations align is probably not worth the effort. |
||
|
|
||
| if cleanDevType != "" && cleanDevName != "" { | ||
| return cleanDevType + "_" + cleanDevName | ||
| } | ||
| return cleanDevName | ||
| } | ||
|
|
||
| func (c *drmCollector) updateAMDCards(ch chan<- prometheus.Metric) error { | ||
| vendor := "amd" | ||
| stats, err := c.fs.ClassDRMCardAMDGPUStats() | ||
|
|
@@ -106,7 +117,7 @@ func (c *drmCollector) updateAMDCards(ch chan<- prometheus.Metric) error { | |
| for _, s := range stats { | ||
| ch <- prometheus.MustNewConstMetric( | ||
| drmCardInfo, prometheus.GaugeValue, 1, | ||
| s.Name, s.MemoryVRAMVendor, s.PowerDPMForcePerformanceLevel, s.UniqueID, vendor) | ||
|
SuperQ marked this conversation as resolved.
|
||
| s.Name, s.MemoryVRAMVendor, s.PowerDPMForcePerformanceLevel, s.UniqueID, chipName(s), vendor) | ||
|
|
||
| ch <- prometheus.MustNewConstMetric( | ||
| drmGPUBusyPercent, prometheus.GaugeValue, float64(s.GPUBusyPercent), s.Name) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.