14 lines
429 B
Python
14 lines
429 B
Python
from __future__ import annotations
|
|
|
|
from fastapi import APIRouter, Response
|
|
from prometheus_client import CONTENT_TYPE_LATEST, generate_latest
|
|
|
|
|
|
router = APIRouter(prefix="/metrics", tags=["monitoring"])
|
|
|
|
|
|
@router.get("", summary="Prometheus metrics endpoint", include_in_schema=False)
|
|
async def metrics_endpoint() -> Response:
|
|
payload = generate_latest()
|
|
return Response(content=payload, media_type=CONTENT_TYPE_LATEST)
|