Add type and name to the DRM parser class#672
Add type and name to the DRM parser class#672Deezzir wants to merge 3 commits intoprometheus:masterfrom
Conversation
2b6737d to
3705157
Compare
|
@discordianfish and @SuperQ please review! Thank you |
sysfs/class_drm_amdgpu.go
Outdated
| HWmonChip string // The hwmon chip. | ||
| } | ||
|
|
||
| func cleanChipName(name string) string { |
There was a problem hiding this comment.
Why do we need to sanitize the name?
There was a problem hiding this comment.
It's something that the hwmon does with the chip names as well, so the format is similar.
There was a problem hiding this comment.
Yes but in that case its used to construct the metric name, which has more limitations. Here its being used as label value, where I don't think we need this
There was a problem hiding this comment.
Do you think it will still be the same and relatable by the chip from the hwmon? It seems like a good idea to align the result to what the hwmon does with its chip names
There was a problem hiding this comment.
I guess in the node-exporter we should also just use the raw chip name and put it in a label instead of the metric name. But I think either way, here, this being used as label value, it should not get santized. But want tohave @SuperQ opinion on this as well.
There was a problem hiding this comment.
A clarification - I don't care if it is sanitized or not; the only reason I am doing a sanitization here is to align the label chip coming from the hwmon metrics (which is also sanitized as per the permalink I provided above) to a new label I've added to the node_drm_card_info metric.
I want to match, aka join a metric like node_hwmon_fan_rpm with node_drm_card_info and have a connection between the two collectors. RN, there is no way to match the metrics coming from those collectors, although both provide metrics for GPUs.
Sanitizing the label before the match makes sense because this is what's being done for the chip label in the hwmon collector.
If you think we shouldn't sanitize the hwmon chip label in the node_exporter, I might provide a PR for that. As of now, I am aligning the behaviour with the existing solution.
There was a problem hiding this comment.
Yeah makes sense, let's see what @SuperQ is thinking about this. I'm fine either way but moving chip to a label in the hwmon collector makes most sense to me.
There was a problem hiding this comment.
I think we should move the chip name to a label in the hwmon collector.
Either way, we shouldn't sanitize the chip name here but in the node-exporter (if we decide to go that path)
|
@discordianfish PTAL |
|
@Deezzir See my comment, sorry for the delay.. |
|
@discordianfish If I understand your comments correctly, I should leave the logic of extracting the |
|
@discordianfish can you please take a look again at the latest comment, so we can finalize the design? |
Yes, exactly. And sorry again for the delay. Unfortunately I don't have any client currently that would pay me for maintaining the node-exporter, so my attention is limited :-/ |
c7a7352 to
d49dc61
Compare
|
@discordianfish I've updated the PR to have unsatitized fields, PTAL |
| } | ||
| cardStats.Name = filepath.Base(card) | ||
| stats = append(stats, cardStats) | ||
| if cardStats != (ClassDRMCardAMDGPUStats{}) { |
There was a problem hiding this comment.
Still don't get it. The function always returns ClassDRMCardAMDGPUStats{}
There was a problem hiding this comment.
The line checks if the struct is empty (zero-initialized) and only appends to the stats list if it is not empty. I've also modified the test file for the module. Previously, the test would produce two struct instances: one valid and one with all elements zero-initialized. It doesn't make much sense to let the empty object be passed as a valid one.
sysfs/class_drm_amdgpu.go
Outdated
| if v, err := readDRMCardField(card, "unique_id"); err == nil { | ||
| stats.UniqueID = v | ||
| } | ||
| if n, t, err := readDevInfo(card); err == nil { |
There was a problem hiding this comment.
Should we silently fail here?
There was a problem hiding this comment.
You mean something like this in case we couldn't retrieve the name & type?
if err != nil {
return ClassDRMCardAMDGPUStats{}, err
}Signed-off-by: Deezzir <yurii.kondrakov@canonical.com>
Signed-off-by: Deezzir <yurii.kondrakov@canonical.com>
Signed-off-by: Deezzir <yurii.kondrakov@canonical.com>
fe1fcfa to
3242a36
Compare
|
@discordianfish PTAL |
Adds a
devNameanddevTypefields toClassDRMCardAMDGPUStatsthat can be later sanitized to be achiplabel in node_exporter.So, those fields from the DRM parser can be sanitized and used to relate to hwmon sensor metrics to build a better dashboard with clear AMD GPU filters.
For example:
Also closes: #673