You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use multiprocessing support even though I am not using gunicorn.
I have a master proc calling multiprocessing.Process() to create workers. (I'm forking but not execing.)
All my mmap files in prometheus_multiproc_dir have the parent process id in the filename. I believe this is not as intended and means that stats are being aggregated as they're saved instead of when they're served. (A performance hit.)
I will try to import prometheus_client after the fork -- and in another file. But that file will be imported... Do the python imports make it impossible for me to have different global _ValueClass's without an exec or monkeying in prometheus_client?
Also, BTW, there is still a reference to shelve in the source.
We don't currently support multiprocessing, as it doesn't work the way we expect gunicorn-like things to.
We currently support a partiuclar model of using multiple processes, not particular libraries.
There is not much documentation about what is and is not supported, nor what model you are refering to, could you expand on that @brian-brazil ?
I have a kafka multiprocess worker which I want to export metrics from. The code below appears to work (I intend to use systemd ExecStopPost to cleanup afterwards), is there something I'm missing?
Is it correct to assume that it would work to simply create multiple python processes (in my case I would use systemd templates) that share the same metrics dir?
Also, sorry for continuing discussion on this closed issue, I feel there is a lack of documentation around what you can and can't do with regards to multiple processes with the python client, and more info in this issue would have helped me.
Activity
brian-brazil commentedon Jan 24, 2017
We don't currently support multiprocessing, as it doesn't work the way we expect gunicorn-like things to.
dozer47528 commentedon Mar 7, 2017
@brian-brazil I have the same problem, any plan to support uwsgi?
brian-brazil commentedon Mar 7, 2017
Can uwsgi start a brand new process for requests?
We currently support a partiuclar model of using multiple processes, not particular libraries.
dozer47528 commentedon Mar 7, 2017
I use uwsgi to start my application
uwsgi --http-socket :8000 --master --workers 4 --enable-threads --threads 10 --wsgi-file server/wsgi.pyThere is one master process and four worker process.
But the
client_pythononly created one file with the pid of master process.brian-brazil commentedon Mar 7, 2017
Unless you can find a way to make it fork&exec each worker, it's not going to work currently.
banteg commentedon Mar 18, 2017
Working uWSGI config example:
esseti commentedon Apr 7, 2017
@banteg can you provide a full example. this is the uwsgi ini file, but how/where do you start the wsgi_server? what port?
ecksun commentedon May 18, 2017
There is not much documentation about what is and is not supported, nor what model you are refering to, could you expand on that @brian-brazil ?
I have a kafka multiprocess worker which I want to export metrics from. The code below appears to work (I intend to use systemd ExecStopPost to cleanup afterwards), is there something I'm missing?
brian-brazil commentedon May 18, 2017
That's just the exposition part which will work anywhere (doesn't even have to be in a related process). The problem is the instrumentation part.
ecksun commentedon May 18, 2017
Okay, what does that mean for me, will all my counters be wrong? Is it possible to get it to work currently at all?
brian-brazil commentedon May 18, 2017
If you're using multiprocessing it won't work currently.
ecksun commentedon May 18, 2017
Alright, thats very sad to hear :(
In which manners will it not work and why not? What changes are required to fix that?
brian-brazil commentedon May 18, 2017
See #127
ecksun commentedon May 18, 2017
Is it correct to assume that it would work to simply create multiple python processes (in my case I would use systemd templates) that share the same metrics dir?
Also, sorry for continuing discussion on this closed issue, I feel there is a lack of documentation around what you can and can't do with regards to multiple processes with the python client, and more info in this issue would have helped me.
brian-brazil commentedon May 18, 2017
This is already being discussed on the other issue, so I consolidated.