diff --git a/poetry.lock b/poetry.lock index d1c1bb4..0ae2db5 100644 --- a/poetry.lock +++ b/poetry.lock @@ -135,6 +135,29 @@ category = "main" optional = false python-versions = ">=3.5" +[[package]] +name = "prometheus-client" +version = "0.13.1" +description = "Python client for the Prometheus monitoring system." +category = "main" +optional = false +python-versions = ">=3.6" + +[package.extras] +twisted = ["twisted"] + +[[package]] +name = "prometheus-fastapi-instrumentator" +version = "5.7.1" +description = "Instrument your FastAPI with Prometheus metrics" +category = "main" +optional = false +python-versions = ">=3.6.0,<4.0.0" + +[package.dependencies] +fastapi = ">=0.38.1,<1.0.0" +prometheus-client = ">=0.8.0,<1.0.0" + [[package]] name = "pydantic" version = "1.9.0" @@ -232,7 +255,7 @@ standard = ["httptools (>=0.2.0,<0.4.0)", "watchgod (>=0.6)", "python-dotenv (>= [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "49aa23d6fb30b9df82433bb137f2692b36688c5e794dc1611d8247cb0b026c78" +content-hash = "64dbb0d31d03be39512a3def521deb69d4ffbb6fc31c7a66e8d2e7b7f4888611" [metadata.files] anyio = [ @@ -279,6 +302,14 @@ idna = [ {file = "idna-3.3-py3-none-any.whl", hash = "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff"}, {file = "idna-3.3.tar.gz", hash = "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"}, ] +prometheus-client = [ + {file = "prometheus_client-0.13.1-py3-none-any.whl", hash = "sha256:357a447fd2359b0a1d2e9b311a0c5778c330cfbe186d880ad5a6b39884652316"}, + {file = "prometheus_client-0.13.1.tar.gz", hash = "sha256:ada41b891b79fca5638bd5cfe149efa86512eaa55987893becd2c6d8d0a5dfc5"}, +] +prometheus-fastapi-instrumentator = [ + {file = "prometheus-fastapi-instrumentator-5.7.1.tar.gz", hash = "sha256:5371f1b494e2b00017a02898d854119b4929025d1a203670b07b3f42dd0b5526"}, + {file = "prometheus_fastapi_instrumentator-5.7.1-py3-none-any.whl", hash = "sha256:da40ea0df14b0e95d584769747fba777522a8df6a8c47cec2edf798f1fff49b5"}, +] pydantic = [ {file = "pydantic-1.9.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:cb23bcc093697cdea2708baae4f9ba0e972960a835af22560f6ae4e7e47d33f5"}, {file = "pydantic-1.9.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1d5278bd9f0eee04a44c712982343103bba63507480bfd2fc2790fa70cd64cf4"}, diff --git a/pyproject.toml b/pyproject.toml index 7d1c5f4..8fd28b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,6 +10,7 @@ fastapi = "^0.70.1" httpx = "^0.21.1" transliterate = "^1.10.2" uvicorn = {extras = ["standart"], version = "^0.16.0"} +prometheus-fastapi-instrumentator = "^5.7.1" [tool.poetry.dev-dependencies] diff --git a/src/core/app.py b/src/core/app.py index 4f37812..b877121 100644 --- a/src/core/app.py +++ b/src/core/app.py @@ -1,5 +1,7 @@ from fastapi import FastAPI +from prometheus_fastapi_instrumentator import Instrumentator + from app.views import router @@ -8,4 +10,6 @@ def start_app() -> FastAPI: app.include_router(router) + Instrumentator().instrument(app).expose(app, include_in_schema=True) + return app