How do I get Appstats to work using Python 2.7 threadsafe and webapp2?
My application is using a streamed version of python 2.7 and I would like to use Appstats with it.
I am currently allowing the execution container to instantiate my application with webapp2.WSGIApplication()
and unfortunately none of my modules are loaded into Appstats.
However, if I follow these instructions http://code.google.com/appengine/docs/python/tools/appstats.html I must use run_wsgi_app()
to call my application. From what I understand, using webapp2.WSGIApplication()
it provides several performance / application caching benefits.
How can I use Appstats with webapp2.WSGIApplication()
and maintain the performance benefits?
source to share
This may be another manifestation of Appstats only work for one WSGIApplication (for which I already logged an internal error, but also showed it works).
source to share
I found that if I included appstates in app.yaml along with the creation of the appengine_config.py file, it seems to me like it works with whatever 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
source to share