Export last frame timestamp metric
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone Build is passing
				
			This commit is contained in:
		| @@ -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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user