Add index to non unique hwmon sensor names#408
Add index to non unique hwmon sensor names#408discordianfish wants to merge 1 commit intoprometheus:masterfrom
Conversation
|
@rtreffer can you take a look? |
|
I'd rather name the sensor after the filename, like |
|
Sorry I'm sick/in bed and can't touch this for the next few days.
Am 7. Januar 2017 07:06:26 MEZ schrieb Tobias Schmidt <notifications@github.com>:
…
@rtreffer can you take a look?
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#408 (comment)
--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
|
|
Looks reasonable.
Am 7. Januar 2017 07:06:26 MEZ schrieb Tobias Schmidt <notifications@github.com>:
…
@rtreffer can you take a look?
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#408 (comment)
--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
|
grobie
left a comment
There was a problem hiding this comment.
The longer I think about it, the more I agree with @SuperQ on using the filename instead. Introducing our own index means users will need to understand the implementation in node_exporter in order to match our names to the their system.
I just checked and many of my sensors don't provide a <sensor>_label file. I'm not it's a good idea to change the value of the sensor label depending on whether a label is available or not, it should be always the same.
Maybe @brian-brazil has another idea, but one option would be to always use the sensor file prefix (temp1, fan2, etc.) as sensor label value and introduce a new metric like node_hwmon_sensor_label with the labels hwmon, sensor, label to export the human readable labels where available.
| for sensor, sensorData := range data { | ||
|
|
||
| // - we need to give duplicated labels an index, so sort sensors first | ||
| sensorIndex := map[string]int{} |
There was a problem hiding this comment.
As we use the hwmon name as label as well, the index structure should be relative to the hwmon group. There is no need to attach a custom index to a sensor name in hwmon4 if there exists a sensor with the same label in hwmon3.
|
Filename sounds the most practical here. |
|
@grobie I wish you thought about those things when reviewing the initial PR.. I'll see if I can find an easy fix, otherwise I'm going to revert the whole hwmon collector since right now it breaks the node-exporter. |
This fixes #406.
Arguably this could be fix more efficient but code could be made more idiomatic but I think it's good enough for now.