Skip to content

Commit de53ea0

Browse files
committed
feat: add prometheus metrics to /metrics
1 parent d42a6cf commit de53ea0

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

prepline_general/api/app.py

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from fastapi.datastructures import FormData
33
from fastapi.responses import JSONResponse
44
from fastapi.security import APIKeyHeader
5+
from prometheus_client import make_asgi_app
56
import logging
67
import os
78

@@ -31,6 +32,9 @@
3132
openapi_tags=[{"name": "general"}],
3233
)
3334

35+
metrics_app = make_asgi_app()
36+
app.mount("/metrics", metrics_app)
37+
3438
# Note(austin) - This logger just dumps exceptions
3539
# We'd rather handle those below, so disable this in deployments
3640
uvicorn_logger = logging.getLogger("uvicorn.error")

requirements/base.in

+1
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ backoff
1616
pypdf
1717
pycryptodome
1818
psutil
19+
prometheus_client

requirements/base.txt

+2
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ pillow==10.4.0
244244
# unstructured-pytesseract
245245
portalocker==2.10.1
246246
# via iopath
247+
prometheus-client==0.21.0
248+
# via -r requirements/base.in
247249
proto-plus==1.24.0
248250
# via
249251
# google-api-core

0 commit comments

Comments
 (0)