stephenhillier / starlette_exporter

Prometheus exporter for Starlette and FastAPI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

multiprocess using the wrong registry

GLeurquin opened this issue · comments

Hi, I believe that when using prometheus_multiproc_dir, the results are not generated correctly because it uses the wrong registry.

in your init.py:
return Response(generate_latest(), status_code=200, headers=headers)
should be
return Response(generate_latest(registry), status_code=200, headers=headers)

otherwise the generated metrics use the default registry, and not the multiprocess one, ending up in metrics being generated per process, and not accumulated for the whole app.

Thanks! I implemented the fix you suggested in a9bda18 and released a new version (v0.4.0)