December 12, 2009

Using appstats with Kay

Guido announced the preview release of appstats. This is a tool for visualizing call stats of RPC Calls on appengine that is very useful for improving application's performance.

This tool consists of two parts; recording part and ui part. There are two ways for configuring the recording part. The first one is to use django middleware which appstats offers. Another way is to configure WSGI middleware. The former way is much easier, so I tried to utilize this django middleware with Kay.

I have thought that I could easily utilize this middleware with small modifications because Kay has a middleware mechanism very similar to the django's one. Finally, and fortunately I can use this middleware without any modification. That's what I aimed for by implementing Kay's middleware mechanism as similarly as possible to django's one!


Configuring the recording part is done by adding appstats.recording.AppStatsDjangoMiddleware to the MIDDLEWARE_CLASSES as above.

Next I need to configure ui part. According to the documentation of appstats, I added an entry to my app.yaml as follows.

- url: /stats.*
  script: appstats/
  login: admin

This is nearly perfect, but a handlers for viewing source code didn't work correctly, so I needed to add these lines to the upper part of appstats/
Updated, thanks Guido!

import kay

That's all. Now I can use appstats with Kay framework. Here are some screenshots.

This is a dashboard.

This is a graphical timeline.

No comments: