Mount has no attribute endpoint
marco-neumann-by opened this issue · comments
If you are using starlette Mount
s (e.g. via FastAPI StaticFiles
):
app.mount("/static", StaticFiles(directory="some/local/path"), name="static")
starlette_exporter
results in the following error log:
ERROR: 'Mount' object has no attribute 'endpoint'
due to this code:
starlette_exporter/starlette_exporter/middleware.py
Lines 54 to 57 in a9bda18
Hi, thanks for the report.
The Mount
object from Starlette doesn't seem to have an endpoint
attribute, which is what I was using to organize paths for the group_paths option. That might make it difficult to group metrics for static files under one path (is that the behavior you want?).
In the meantime I can try to improve the error handling.
I have a potential solution that still allows grouping of static file metrics, but it needs more thorough testing... I opened a pull request in case you have any comments. #7