Prior versions of oslo.utils have known issues with the EventletEvent
class that we use, so we should avoid them.
This patch enables profiling (capturing function call trace like
cProfile ) worker processes on the fly while service is running.
User requests the oslo service process to start profiling by writing
"prof()" command to backdoor socket, once the service (like
neutron-server) finishes expected processing (example finishing API
call), user again writes "prof()" command with file name as argument
to dump the function calltrace stats. Stats file (in pstat format
with user provided filename by adding .prof) will be generated in
For example, to profile neutron server process,
1) echo "prof()" | nc localhost 8002
2) Issue neutron command (or run rally scenarios tests)
neutron net-create n1
neutron port-create --name p1 n1
neutron port-delete p1
neutron net-delete n1
3) echo "prof('neutron')" | nc localhost 8002
where 8002 is the port which we set like below in neutron.conf
We can later print the stats from the trace file like below
stats = pstats.Stats('/tmp/neutron.prof')
The trace file will look like in (for above neutron API calls) .
We use Yappi with context set to greenlet  to profile greenlets.
We can't use GreenletProfiler , which does the same 
1) as it is no more maintained
2) Also compiling yappi source inside GreenletProfiler is failing for
Instead of having a copy-pasted version in this project, let's just
use the original directly. It is added to the public API of
oslo.utils in the dependency.
With the upgrade to oslotest 3.6.0 , testr no longer works .
This is because oslotest no longer requires testr and we don't depend
on it directly in oslo.service. Let's switch to using stestr, too!
Everyone's doing it...
This patch follows  in oslo.policy