mirror of
https://github.com/tcivie/meshtastic-metrics-exporter.git
synced 2024-12-27 14:39:57 -08:00
Merge pull request #17 from tcivie/update-metrics
Update metrics + Fix bug with parsing of client roles and device information
This commit is contained in:
commit
05e6354260
|
@ -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'
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue