Generating a Callgraph for Keystone

Once I know a starting point for a call, I want to track the other functions that it calls. pycallgraph will generate an image that shows me that.

All this is done inside the virtual env set up by tox at keystone/.tox/py35

I need a stub of a script file in order to run it. I’ll put this in tmp:

from keystone.identity import controllers
from keystone.server import wsgi
from keystone.common import request
def main():
    d = dict()
    r  = request.Request(d)
    c = controllers.UserV3()
if __name__ == '__main__':

To install pycallgraph:

pip install pycallgraph

And to run it:

 pycallgraph  --max-depth 6  graphviz /tmp/

It errors out do to auth issues (it is actually rtunning the code, so don’t do this on a production server)

Here is what it generated.

Click to enlarge. Not great, but it is a start.

Leave a Reply

Your email address will not be published. Required fields are marked *