I want to add a custom `/health` path in Python prometheus_client.
I am using Flask and Gunicorn for this.
Unfortunately, it doesn't work. I have tried:
```python
from flask import Flask
from werkzeug.middleware.dispatcher import DispatcherMiddleware
from prometheus_client import make_wsgi_app
from prometheus_client.core import REGISTRY
from exporter.collector import Collector
REGISTRY.register(Collector())
app = Flask(__name__)
def health():
return {"status": "running", "build": "111"}
app.wsgi_app = DispatcherMiddleware(
app.wsgi_app, {"/metrics": make_wsgi_app(), "/health": health()}
)
```
I also try to use flask `@app.route` decorator. But dosn't work too:
```python
@app.route("/health")
def health():
return {"status": "running", "build": "111"}
app.wsgi_app = DispatcherMiddleware(
app.wsgi_app, {"/metrics": make_wsgi_app(), "/health": health()}
)
```
Any endpoint (even undefined such `/foo`) will produce the same content as
`/metrics`
--
You received this message because you are subscribed to the Google Groups
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/2c9a058c-4e1c-4588-9fd4-7ac75ac73906n%40googlegroups.com.