Skip to content

Commit

Permalink
Readd prometheus endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
TimKoornstra committed Jun 26, 2024
1 parent 03995a7 commit 05192de
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/api/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@

# > Third-party dependencies
from fastapi import APIRouter, HTTPException, File, UploadFile, Form, FastAPI
from fastapi.responses import JSONResponse
from fastapi.responses import JSONResponse, Response
from prometheus_client import generate_latest, CONTENT_TYPE_LATEST

# > Local dependencies
from app_utils import extract_request_data


def create_router(app: FastAPI) -> APIRouter:
"""
Create an API router with endpoints for prediction, health check, and readiness check.
Create an API router with endpoints for prediction, health check, and
readiness check.
Parameters
----------
Expand Down Expand Up @@ -148,4 +150,9 @@ async def ready():
}
)

@router.get("/prometheus")
async def prometheus():
metrics = generate_latest()
return Response(content=metrics, media_type=CONTENT_TYPE_LATEST)

return router

0 comments on commit 05192de

Please sign in to comment.