django-prometheus icon indicating copy to clipboard operation
django-prometheus copied to clipboard

Fix use of dedicated listeners with multiprocess

Open riconnon opened this issue 4 years ago • 5 comments
trafficstars

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.

riconnon avatar Aug 18 '21 23:08 riconnon

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.

riconnon avatar Feb 20 '22 23:02 riconnon

please provide some more context for this change.. What problem does it solve ? what is the use case for this ?

asherf avatar Feb 21 '22 15:02 asherf

@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.

riconnon avatar Apr 09 '22 14:04 riconnon

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.

tykling avatar May 18 '22 06:05 tykling