statsd: run at 2Hz (#23493)

old-commit-hash: 44592f4b0e
commatwo_master
Willem Melching 3 years ago committed by GitHub
parent 002c79d2d5
commit 755c1f606e
  1. 10
      selfdrive/statsd.py

@ -73,6 +73,11 @@ def main():
last_flush_time = time.monotonic()
gauges = {}
while True:
started_prev = sm['deviceState'].started
sm.update()
# Update metrics
while True:
try:
metric = sock.recv_string(zmq.NOBLOCK)
@ -88,10 +93,7 @@ def main():
except Exception:
cloudlog.event("malformed metric", metric=metric)
except zmq.error.Again:
time.sleep(1e-3)
started_prev = sm['deviceState'].started
sm.update(0)
break
# flush when started state changes or after FLUSH_TIME_S
if (time.monotonic() > last_flush_time + STATS_FLUSH_TIME_S) or (sm['deviceState'].started != started_prev):

Loading…
Cancel
Save