diff --git a/exporter/client_details.py b/exporter/client_details.py index 5078848..3e462d0 100644 --- a/exporter/client_details.py +++ b/exporter/client_details.py @@ -24,7 +24,7 @@ class ClientDetails: def get_role_name_from_role(role): descriptor = Config.DeviceConfig.Role.DESCRIPTOR for enum_value in descriptor.values: - if enum_value.number == role: + if enum_value.number == role or enum_value.name == role: return enum_value.name return 'UNKNOWN_ROLE' @@ -32,6 +32,6 @@ class ClientDetails: def get_hardware_model_name_from_code(hardware_model): descriptor = HardwareModel.DESCRIPTOR for enum_value in descriptor.values: - if enum_value.number == hardware_model: + if enum_value.number == hardware_model or enum_value.name == hardware_model: return enum_value.name return 'UNKNOWN_HARDWARE_MODEL' diff --git a/exporter/processor_base.py b/exporter/processor_base.py index ec9d2ef..3fc03a3 100644 --- a/exporter/processor_base.py +++ b/exporter/processor_base.py @@ -20,7 +20,7 @@ class MessageProcessor: self.hop_start_gauge = None self.via_mqtt_counter = None self.want_ack_counter = None - self.hop_limit_counter = None + self.hop_limit_gauge = None self.rx_snr_gauge = None self.rx_time_histogram = None self.total_packets_counter = None @@ -73,7 +73,7 @@ class MessageProcessor: registry=self.registry ) # Counter for hop_limit - self.hop_limit_counter = Counter( + self.hop_limit_gauge = Gauge( 'mesh_packet_hop_limit', 'Hop limit of mesh packets', common_labels, @@ -205,9 +205,9 @@ class MessageProcessor: **common_labels ).set(mesh_packet.rx_snr) - self.hop_limit_counter.labels( + self.hop_limit_gauge.labels( **common_labels - ).inc(mesh_packet.hop_limit) + ).set(mesh_packet.hop_limit) if mesh_packet.want_ack: self.want_ack_counter.labels(