I need to perform a large number (~120) of metric label remappings in my prometheus config. Right now I'm doing it with 120 entries that look like these:
- source_labels: [fcFeModuleName,fcFxPortIndex]
target_label: portName
regex: 0x100000C0DD18FE13;1
replacement: DeviceName
- source_labels: [fcFeModuleName,fcFxPortIndex]
target_label: portName
regex: 0x100000C0DD18FE13;2
replacement: AnotherDeviceName
...repeated for many different combinations of fcFeModuleName and fcFxPortIndex. The regex that I'm using doesn't have any RE patterns in it, so this mapping could be reduced to a simple non-regex map. I was hoping I could do something a little more concise, like this:
- source_labels: [fcFeModuleName,fcFxPortIndex]
target_label: portName
replacement_map:
"0x100000C0DD18FE13;1": DeviceName
"0x100000C0DD18FE13;2": AnotherDeviceName
"0x100000C0DD18FE13;3": andYetAnother
Is something concise like this already possible, or should I file a RFE?
I do note that if I were scraping an ethernet switch, I could use portIndex+portName in my snmp_exporter to assign friendly names as labels automatically. But my fiberchannel switch does not expose the friendly names via snmp, thus the need to do the friendly name label assignment individually in prometheus.
--Mike