File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -260,6 +260,24 @@ async def health_check() -> JSONResponse:
260260 })
261261
262262
263+ @app .get (
264+ "/stats/queue" ,
265+ summary = "Get queue depth" ,
266+ description = "Returns the number of items in a Redis list (queue)" ,
267+ tags = ["system" ],
268+ )
269+ async def get_queue_depth (
270+ list_name : str = Query (..., description = "Name of the Redis list to measure" )
271+ ) -> JSONResponse :
272+ """Get the current depth of a Redis list. Public endpoint (no auth) for monitoring and backpressure."""
273+ try :
274+ depth = await redis_async .llen (list_name )
275+ return JSONResponse (content = {"list_name" : list_name , "depth" : depth })
276+ except Exception as e :
277+ logger .error (f"Error getting queue depth for '{ list_name } ': { str (e )} " )
278+ raise HTTPException (status_code = 500 , detail = "Failed to get queue depth" )
279+
280+
263281class Vcon (BaseModel ):
264282 """Pydantic model representing a vCon (Voice Conversation) record.
265283
You can’t perform that action at this time.
0 commit comments