[Grok-dev] a nice research project
Chris McDonough
chrism at plope.com
Sat Feb 7 17:14:33 EST 2009
Martijn Faassen wrote:
> Hey,
>
> How one would do such research could be:
>
> * replicate the setup
>
> * place a "import pdb; pdb.set_trace()" in some function (like somewhere
> in minidom or ZPT) that we don't understand gets called in this case.
>
> * start grok
>
> * make a request
>
> * in pdb, look at the 'bt' (backtrace), and perhaps use 'up' to walk up
> the call chain, trying to understand what is triggering this.
You can also use repoze.profile
(http://pypi.python.org/packages/source/r/repoze.profile/repoze.profile-0.6.tar.gz#md5=544a3f626c407eeda5daa3bf5bd77aeb)
for this. It's likely a lot easier than what's described above.
To install it into a grokproject-generated Grok instance add it to the eggs
section of the [app] section of your buildout:
[app]
recipe = zc.recipe.egg
eggs = helloworld
z3c.evalexception>=2.0
Paste
PasteScript
PasteDeploy
repoze.profile
Then rerun buildout.
Put repoze.profile in the WSGI pipeline e.g.:
[pipeline:main]
pipeline =
egg:repoze.profile#profile
egg:helloworld
[server:main]
use = egg:Paste#http
host = 127.0.0.1
port = 8080
[DEFAULT]
# set the name of the zope.conf file
zope_conf = %(here)s/zope.conf
Then restart your Grok app and unleash ab on the app. When it's done, visit
http://localhost:8080/__profile__, and in the "mode" dropdown, select "callers",
then click "Update". It will show you in the left hand column the function that
was called; in the right hand column the callers of that function.
- C
More information about the Grok-dev
mailing list