trallnag / prometheus-fastapi-instrumentator

Instrument your FastAPI with Prometheus metrics.
ISC License
929 stars 83 forks source link

Remove FastAPI in favor of Starlette #280

Closed mvanderlee closed 6 months ago

mvanderlee commented 8 months ago

This project imports FastAPI simply to provide type hints. Moreover the middleware's function isn't limited to FastAPI and works fine with any Starlette implementation.

It'd be great if all code references to FastAPI could be replaced with Starlette.

chbndrhnns commented 6 months ago

When I was looking for an instrumentation for starlette, I knew about this package and now I am also wondering if I can just throw a Starlette app at it. I'll give it a try!

mvanderlee commented 6 months ago

@chbndrhnns atm, I've been using my branch https://github.com/mvanderlee/prometheus-starlette-instrumentator/tree/no-fastapi

requirements.txt

git+https://github.com/mvanderlee/prometheus-starlette-instrumentator.git@da344ce83c5c40b70fd7f0b2fb33905d9498ee3c

setup.py

setup(
    install_requires=[
        'prometheus-fastapi-instrumentator @ git+https://github.com/mvanderlee/prometheus-starlette-instrumentator.git@da344ce83c5c40b70fd7f0b2fb33905d9498ee3c',
    ],
)
chbndrhnns commented 6 months ago

We have FastAPI installed anyway for another use case so it seems I am good to way with this version here, as well. Thanks for the link, though!