Export last frame timestamp metric

lint_test
Lauri Võsandi 12 months ago committed by Lauri Võsandi
parent 3d792bfbc9
commit b903fca13d
  1. 6
      camdetect.py

@ -13,6 +13,7 @@ from prometheus_client import Counter, Gauge
from sanic import Sanic, response
from sanic.response import stream
from sanic_prometheus import monitor
from time import time
_, url = sys.argv
@ -54,7 +55,9 @@ counter_errors = Counter(
counter_movement_frames = Counter(
"camdetect_movement_frames",
"Frames with movement detected in them")
gauge_last_frame = Gauge(
"camdetect_last_frame",
"Timestamp of last frame")
gauge_total_blocks = Gauge(
"camdetect_total_blocks",
"Total DCT blocks")
@ -86,6 +89,7 @@ async def client_connect(resp):
continue
else:
app.ctx.last_frame = Frame(buf + data[:marker+2])
gauge_last_frame.set(time())
reference = app.ctx.last_frame.mask
app.ctx.frames.append(reference)

Loading…
Cancel
Save