-
Notifications
You must be signed in to change notification settings - Fork 830
Open
Description
The documentation gives an example application which mounts the ASGI app to /metrics
in a FastAPI app
from fastapi import FastAPI
from prometheus_client import make_asgi_app
# Create app
app = FastAPI(debug=False)
# Add prometheus asgi middleware to route /metrics requests
metrics_app = make_asgi_app()
app.mount("/metrics", metrics_app)
and says that you should be able to see the metrics at http://localhost:8000/metrics, however if you try to access this endpoint
$ uvicorn app:app
INFO: Started server process [1620866]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: 127.0.0.1:34428 - "GET / HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:34428 - "GET /favicon.ico HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:34444 - "GET /metrics HTTP/1.1" 307 Temporary Redirect
INFO: 127.0.0.1:34444 - "GET /metrics/ HTTP/1.1" 200 OK
you get redirected to /metrics/
.
It would be better if this redirect could be avoided.
avshalomman, Sakoes, nmzgnv, Yotambu100, seowjin1060 and 5 more
Metadata
Metadata
Assignees
Labels
No labels