I'm trying to get Appstats to work on my GAE Python app. I'm using webapp2 with python 2.7.
I've followed the instructions from https://developers.google.com/appengine/docs/python/tools/appstats#Setup which includes creating the appengine_config.py file:
def webapp_add_wsgi_middleware(app):
from google.appengine.ext.appstats import recording
app = recording.appstats_wsgi_middleware(app)
return app
And adding the following lines to my app.yaml:
builtins:
- appstats: on
The python app I wish to use Appstats on looks something like this:
import webapp2
from google.appengine.api import urlfetch
from google.appengine.ext import db
import appengine_config
class MainHandler(webapp2.RequestHandler):
def get(self):
self.response.write('Hello word!')
app = webapp2.WSGIApplication([
webapp2.Route(r'/method1/', handler=Method1, name='method1'),
webapp2.Route(r'/method2/', handler=Method2, name='method2'),
webapp2.Route(r'/', handler=MainHandler, name='home')
], debug=True)
(I tried import appengine_config
after reading the comments from Appstats are only working for one WSGIApplication but that doesn't work neither)
The problem I'm facing is that I can see the appstats console at /_ah/stats
but it is not recording anything even after many requests have been made to the app.
I'm wondering if it has anything to do with the fact that I'm using extended URL routes? I'd really like to use webapps2 extended routing, so I hope Appstats doesn't have issues with it. If anyone has any insights on what I'm doing wrong, it will really help!
Thanks loads in advance!