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
- Setup your application 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.
- Create a config file 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
- Adjust URL mappings in app.yaml 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.
Next add the middleware where you are setting your application
google/appengine/ext/appstatusin your SDK, and copy that file as appengine_config.py and save it in application root.