INNER CODE UNIT · Python
track_requests
kaito-project/kaito · presets/ragengine/main.py:146
async def track_requests(request: Request, call_next):
tracked_paths = [
"/index",
"/indexes",
"/persist",
"/load",
"/retrieve",
"/v1/chat/completions",
]
should_track = any(request.url.path.startswith(path) for path in tracked_paths)
if not should_track:
return await call_next(request)
num_requests_running.inc()
start_time = time.perf_counter()
status = STATUS_FAILURE # Default status