Update prometheus_frigate_exporter.py

main
Rhys Bailey 2024-03-18 23:02:35 +11:00
parent 9b4af20584
commit e3dd5a41f4
1 changed files with 2 additions and 2 deletions

View File

@ -13,9 +13,9 @@ from prometheus_client import start_http_server
def add_metric(metric, label, stats, key, multiplier=1.0):
try:
string = str(stats[key])
value = float(re.findall(r'\d+', string)[0])
value = float(re.findall(r'-?\d*\.?\d*', string)[0])
metric.add_metric(label, value * multiplier)
except (KeyError, TypeError, IndexError):
except (KeyError, TypeError, IndexError, ValueError):
pass