Skip to content
Browse files

Add a little more documentation to the demo

  • Loading branch information...
1 parent 673a0d1 commit cf1069f5b2616d957cbae8a912b8ea75dcce89cf Ben Darnell committed Jul 23, 2010
Showing with 19 additions and 4 deletions.
  1. +19 −4 demo/main.py
View
23 demo/main.py
@@ -1,7 +1,17 @@
#!/usr/bin/env python
-#
-# export PYTHONPATH=.:../tornado:/usr/local/google_appengine:/usr/local/google_appengine/lib/webob
-# $PWD/demo/main.py --enable_appstats
+'''Demo of appstats tracing.
+
+Starts a simple server with appstats enabled. Go to http://localhost:8888/
+to generate some sample data, then go to http://localhost:8888/appstats/
+to see the results.
+
+Requires tornado, tornado_tracing, and the google appengine sdk to be
+on $PYTHONPATH. It also doesn't like it when the app is started using
+a relative path, so run it with something like this:
+
+ export PYTHONPATH=.:../tornado:/usr/local/google_appengine:/usr/local/google_appengine/lib/webob
+ $PWD/demo/main.py
+'''
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
@@ -24,6 +34,9 @@ def get(self):
def handle_timeout(self):
self.finish("ok")
+# A handler that performs several HTTP requests taking different amount of
+# time. It waits for the first request to finish, then issues three requests
+# in parallel.
class RootHandler(recording.RecordingRequestHandler):
@asynchronous
def get(self):
@@ -48,10 +61,12 @@ def step2(self, response):
self.handle_step2_fetch)
def step3(self):
- self.finish('all done')
+ self.finish('All done. See results <a href="/appstats/">here</a>.')
def main():
parse_command_line()
+ # doesn't make much sense to run this without appstats enabled
+ options.enable_appstats = True
recording.setup_memcache([options.memcache])
app = Application([

0 comments on commit cf1069f

Please sign in to comment.
Something went wrong with that request. Please try again.