uvicorn
uvicorn copied to clipboard
Access logs for mounted apps doesnt not contain the root path
This change broke our monitoring a bit. We use FastAPI and mount a ASGI-app to /graphql
route.
Since access logs are not really useful for GraphQL we filter them out in our monitoring to avoid a lot of noise.
Since this change access logs are logging /
instead of /graphql
which breaks this and makes our logs very noisy again.
Originally posted by @levrik in https://github.com/encode/uvicorn/issues/1294#issuecomment-1046761532
thanks for that @levrik
we should maybe use raw_path instead of path in
def get_path_with_query_string(scope: WWWScope) -> str:
path_with_query_string = urllib.parse.quote(scope["path"])
Thanks a lot for transitioning this into an issue. I'll give your suggestion a try and open a PR.
I've opened a PR (#1385) which switches to raw_path
in logging. We've tested this with our application which successfully brought the log filtering back to life.
Same issue as https://github.com/pgjones/hypercorn/issues/75.
This is an issue on Starlette's side: https://github.com/encode/starlette/issues/1336.