This repository has been archived by the owner on Sep 13, 2023. It is now read-only.
Errors in middlewares break fastapi service #659
Labels
bug
Something isn't working
monitoring
Enabling model monitoring - exposing stats to be collected by prometheus and other services
p2-medium
Medium priority
plugins
Plugins and extensions for MLEM!
serve
Serving models
Not so long ago, we added Prometheus middleware https://github.com/iterative/mlem/blob/main/mlem/contrib/prometheus.py which can be attached to FastAPI service MLEM is building, processing requests and responses data and exposing
/metrics
endpoint to be scraped by Prometheus.It happens, that if code in middleware breaks, the server doesn't return the response. Which is a shame, it still needs to return response in any case. We need to fix this.
Example can be found in https://github.com/aguschin/art-expert-telegram-bot/tree/main/fastapi-deployment:
server.mlem
has a config example, you can use it to run the servicelang_metric.py
has middleware metrics code - to reproduce simply make any of them fail (1/0
will suffice)Setting
p2
priority since the feature is not documented and is experimental.The text was updated successfully, but these errors were encountered: