Expose prometheus metrics for all apps

This commit is contained in:
dongli 2025-03-02 17:08:08 -08:00
parent e13a05cb43
commit 0f02181e33
8 changed files with 21 additions and 4 deletions

View File

@ -12,4 +12,5 @@ aio-pika
httpx
pydantic-settings
python-jose
passlib[bcrypt]
passlib[bcrypt]
prometheus_fastapi_instrumentator==7.0.2

View File

@ -11,6 +11,7 @@ from webapi.providers import database
from webapi.providers import exception_handler
from .freeleaps_app import FreeleapsApp
from prometheus_fastapi_instrumentator import Instrumentator
def create_app() -> FastAPI:
logging.info("App initializing")
@ -26,6 +27,8 @@ def create_app() -> FastAPI:
# Call the custom_openapi function to change the OpenAPI version
customize_openapi_security(app)
# expose prometheus metrics
Instrumentator().instrument(app).expose(app)
return app

View File

@ -12,4 +12,5 @@ python-multipart
python-jose
azure-storage-blob==12.22.0
azure-identity
azure-core[aio]
azure-core[aio]
prometheus_fastapi_instrumentator==7.0.2

View File

@ -10,6 +10,8 @@ from webapi.providers import scheduler
from webapi.providers import exception_handler
from .freeleaps_app import FreeleapsApp
from prometheus_fastapi_instrumentator import Instrumentator
def create_app() -> FastAPI:
logging.info("App initializing")
@ -25,6 +27,8 @@ def create_app() -> FastAPI:
# Call the custom_openapi function to change the OpenAPI version
customize_openapi_security(app)
# expose prometheus metrics
Instrumentator().instrument(app).expose(app)
return app

View File

@ -30,4 +30,5 @@ azure-storage-blob[aio]
azure-identity
azure-core[aio]
sendgrid
httpx
httpx
prometheus_fastapi_instrumentator==7.0.2

View File

@ -11,6 +11,7 @@ from webapi.providers import scheduler
from webapi.providers import exception_handler
from .freeleaps_app import FreeleapsApp
from prometheus_fastapi_instrumentator import Instrumentator
def create_app() -> FastAPI:
logging.info("App initializing")
@ -26,6 +27,8 @@ def create_app() -> FastAPI:
# Call the custom_openapi function to change the OpenAPI version
customize_openapi_security(app)
# expose prometheus metrics
Instrumentator().instrument(app).expose(app)
return app

View File

@ -11,4 +11,5 @@ aio-pika
twilio
pydantic-settings
python-multipart
python-jose
python-jose
prometheus_fastapi_instrumentator==7.0.2

View File

@ -11,6 +11,7 @@ from webapi.providers import message_queue
from webapi.providers import exception_handler
from .freeleaps_app import FreeleapsApp
from prometheus_fastapi_instrumentator import Instrumentator
def create_app() -> FastAPI:
logging.info("App initializing")
@ -27,6 +28,8 @@ def create_app() -> FastAPI:
# Call the custom_openapi function to change the OpenAPI version
customize_openapi_security(app)
# expose prometheus metrics
Instrumentator().instrument(app).expose(app)
return app