django-prometheus
django-prometheus copied to clipboard
Fix use of dedicated listeners with multiprocess
Extract the code to select the registry used for the exporter from the Django view and provide the registry as a parameter to clients for deciated listeners as well.
Hi @korfuri I've just rebased this over your latest, and I wondered if you might have time to take a look at this.
For me, without this, I'm unable to make a working setup using multiprocess and dedicated listeners.
please provide some more context for this change.. What problem does it solve ? what is the use case for this ?
@asherf I'm using a dedicated WSGI listener for metrics collection, and multiprocess mode to support my WSGI/ASGI running multiple processes. With the code from master this didn't work, and I ended up with no metrics because the listener was not using the same registry as the multiprocess collector.
I think I might be facing this issue. Any update on merging this? @riconnon if you understand the issue well enough maybe you can include a testcase which demonstrates it, although I understand it is not trivial given the nature of multiproc stuff.