Skip to content

Commit

Permalink
add middleware to trace endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
sureshhewabi committed May 28, 2024
1 parent 6becc0d commit 882cb94
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ async def log_request_time(request: Request, call_next):
logger.error(f"Request: {request.method} {request.url.path} raised an error in {process_time:.4f} seconds: {str(e)}")
raise
process_time = time.time() - start_time
logger.info(f"Request: {request.method} {request.url.path} completed in {process_time:.4f} seconds")
if not (request.url.path.startswith("/pride/ws/archive/crosslinking/data/visualisations") or
request.url.path.startswith("/pride/ws/archive/crosslinking/health")):
logger.info(f"Request: {request.method} {request.url.path} completed in {process_time:.4f} seconds")

return response

app.include_router(pride_router, prefix="/pride/ws/archive/crosslinking")
Expand Down

0 comments on commit 882cb94

Please sign in to comment.