Feature request: Extract custom labels from topic
tykling opened this issue · 2 comments
tykling commented
Hello,
It would be nice to be able to extract labels (other than deviceid) from the mqtt topic. A new config dict with labelname: regex pairs could be very useful for adding labels with data encoded in mqtt topics.
Thanks! :)
hikhvar commented
Please have a look at this issue: #45 (comment)
The exporter exports the topic of every metric to prometheus. You can use relabeling in prometheus to create new labels from that label:
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
tykling commented
I am using relabelling in prom today. I can just keep doing that, although I still think it would be prettier to do it in this exporter to keep the prom config smaller. Thanks :)