czerwonk / junos_exporter

Exporter for devices running JunOS to use with https://prometheus.io/
MIT License
198 stars 81 forks source link

dynamic interface labels returns empty labels on all interfaces #159

Open momorientes opened 3 years ago

momorientes commented 3 years ago

Say I have an interface with description test [foo=bar] as expected junos_exporter will correctly map foo=bar into its own label:

# some labels omitted for readability
junos_interface_IPv6_receive_packets_total{description="test [foo=bar]",foo="bar",name="xe-0/1/3"} 1234

However a interface with no labelset in the description on the same device, i.e. LINK switch1 ae0 will have an empty foo="" label.:

junos_interface_IPv6_receive_packets_total{description="LINK switch1 ae0",foo="name="ae1"} 5678

This will be done for every label should there be multiple labels defined.

Prometheus seems to drop these "empty labels" on import, however IMO they shouldn't show up in the exporter. Is this intended behavior?

czerwonk commented 3 years ago

Sadly it is. Since the label count of a metric is fix (as defined in the descrption) we have to add them for interfaces not matching the label regex.