Step 1: Download the Python libraryClone the git repository from here:
git clone https://code.google.com/p/prodeagle-python/
or alternatively you can download a zipped archive of the Python library from here.
Step 2: Add counters to your codeWhen ever you would like to increment a counter, just call:
import prodeagle.counter prodeagle.counter.incr("Your.Counter.Name")
Behind the scenes, this will result in a "incr" call to the memcache service, which is blazing fast 1).
To update multiple counters at the same time, you can do batch requests like this:
import prodeagle.counter counters = prodeagle.counter.Batch() counters.incr("Food.ChocolateBars") counters.incr("Food.CerealBars") counters.incr("Food.FooBars") counters.commit()
This will only do a single call to memcache instead of three sequential ones.
You can also increment a counter by any discrete number, for example by 5:
import prodeagle.counter prodeagle.counter.incr("ChocolateBars", 5)
Step 3: Set up the ProdEagle export handlerProdEagle needs to come and collect your counter data in order to be able display graphs and alert you when they drop or exceed a certain value.
Add the following handler to your app.yaml:
handlers: - url: /prodeagle/ script: /prodeagle/harvest.py
This handler already has its own authentication method and only allows access to ProdEagle.com and Administrators of your app.
Do not add additional authentication methods like login: admin.
You should now be able to see by how much your counters have been incremented since the last time ProdEagle.com collected your data on http://your-app-id.appspot.com/prodeagle/
Step 4: Set up ProdEagle.com to collect your counter dataGo to ProdEagle.com and login using a Google Account that is an Administrator of your AppEngine app.
Add your appid.appspot.com in the "Your monitored websites" section.
Make sure you use https! Don't use a custom domain if you have on, just use https://appid.appspot.com.
Now ProdEagle.com will come and export your data every minute. You need to wait for the first export and then you can start creating new graphs and set up new alerts! Sweet, huh?
1) The first time a counter is incremented, the framework needs to do a datastore write. Additionally, when a fresh serving instance is started, the framework needs to read a datastore entry that contains all counter names. The ProdEagle.* counters record these events if SAVE_PRODEAGLE_STATS in prodeagle.counter is True (default).