Saturday 29 May, 2010

Using Appstats in Glashammer


If you are using Google App Engine for developing and deploying your web application written in Python, chances are high that you must be using AppStats for measuring the performance of your application. Well, if you haven't its the right time for you to start using it.
The details about how to use AppStats with Google App Engine in WebApp framework and the Django framework are available at the official app engine documentation.

Here, i will tell you how to use AppStats in your Glashammer application.

AppStats is a middleware, so it stands somewhere between your client and the app engine server. It measures each request coming and its response generated and provides valuable data for developers to tune up their app.

So here are the steps
  1. Setup your application
  2. Most probably, you might be performing setup of your application in the main.py. You need to add the middleware to the application. For this first import the appstats_wsgi_middleware class.
    Next add the middleware where you are setting your application
    app.add_middleware(appstats_wsgi_middleware)
  3. Create a config file
  4. The config file is a file named appengine_config.py located at the application root level. You can get a sample file from the location
    google/appengine/ext/appstatus
    in your SDK, and copy that file as appengine_config.py and save it in application root.
  5. Adjust URL mappings in app.yaml
  6. After you are done with these two you now need to map the URLs to the views of appstats view handler. In order to do this, modify your app.yaml file by adding the following line If you have any mapping as /.*, make sure that you add the line above that mappings.
That's it. You are done. Now when you run your application, you will see appstats details in the terminal log. You can also view the details for all prev records at /stats.

No comments:

Post a Comment