3

My app uses the threadsafe version of python 2.7 and I would like to use Appstats with it.

I currently let the runtime container instantiate my app using webapp2.WSGIApplication() and unfortunately none of my modules are picked up in Appstats.

However, if I follow these http://code.google.com/appengine/docs/python/tools/appstats.html instructions I should use run_wsgi_app() to invoke my application. From what I understand using webapp2.WSGIApplication() confers several performance/app caching benefits.

How can I use Appstats with webapp2.WSGIApplication() and keep the performance benefits?

Dan
  • 5,013
  • 5
  • 33
  • 59

2 Answers2

7

I found that if I enabled appstates in app.yaml along with create the appengine_config.py file it seems to me it works with anything I throw at it.

app.yaml

builtins:
  - admin_redirect: on
  - appstats: on

appengine_config.py:

def webapp_add_wsgi_middleware(app):
    from google.appengine.ext.appstats import recording
    app = recording.appstats_wsgi_middleware(app)
    return app
mindlesstux
  • 308
  • 2
  • 8
3

This might be another manifestation of Appstats are only working for one WSGIApplication (for which I filed an internal bug already, but also showed a work-around).

Community
  • 1
  • 1
Guido van Rossum
  • 16,690
  • 3
  • 46
  • 49