prometheus / prometheus/client_python
ASGI mounted to FastAPI mounts metrics to `/metrics/` instead of `/metrics`
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 4.4k
- Forks
- 876
- Merge moyen
- 8 j 4 h
- PR mergées (30 j)
- 1
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.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par l’exemple FastAPI dans la documentation liée et reproduisez la requête /metrics montée avec uvicorn. Vérifiez si la redirection est contrôlée par l’exemple client_python documenté ou par le comportement de montage de FastAPI ; le travail est terminé si la redirection est évitée ou si le comportement réel de l’endpoint est clairement documenté.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- fastapi, python
- Domaine
- api, backend
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100