Python google.appengine.ext.appstats.recording.appstats_wsgi_middleware() Examples

The following are code examples for showing how to use google.appengine.ext.appstats.recording.appstats_wsgi_middleware(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: github-stats   Author: lipis   File: appengine_config.py    MIT License 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
  from google.appengine.ext.appstats import recording
  app = recording.appstats_wsgi_middleware(app)
  return app 
Example 2
Project: gae-init-magic   Author: gae-init   File: appengine_config.py    MIT License 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
  from google.appengine.ext.appstats import recording
  app = recording.appstats_wsgi_middleware(app)
  return app 
Example 3
Project: tra-tracking-on-gae   Author: elliot79313   File: appengine_config.py    MIT License 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
    from google.appengine.ext.appstats import recording
    app = SessionMiddleware(app, cookie_key=COOKIE_KEY)
    app = recording.appstats_wsgi_middleware(app)
    return app 
Example 4
Project: mlab-ns   Author: m-lab   File: appengine_config.py    Apache License 2.0 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
    from google.appengine.ext.appstats import recording
    app = recording.appstats_wsgi_middleware(app)
    return app

# Add any libraries in the "mlabns/third_party" directory. 
Example 5
Project: vote4code   Author: welovecoding   File: appengine_config.py    MIT License 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
  from google.appengine.ext.appstats import recording
  app = recording.appstats_wsgi_middleware(app)
  return app 
Example 6
Project: syndicate-core   Author: syndicate-storage   File: appengine_config.py    Apache License 2.0 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
    from google.appengine.ext.appstats import recording
    app = recording.appstats_wsgi_middleware(app)
    return app 
Example 7
Project: crypto-pocket   Author: lipis   File: appengine_config.py    MIT License 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
  from google.appengine.ext.appstats import recording
  app = recording.appstats_wsgi_middleware(app)
  return app 
Example 8
Project: eve-metrics   Author: ccpgames   File: appengine_config.example.py    MIT License 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
    from google.appengine.ext.appstats import recording
    app = recording.appstats_wsgi_middleware(app)
    return app 
Example 9
Project: eve-metrics   Author: ccpgames   File: appengine_config.py    MIT License 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
    from google.appengine.ext.appstats import recording
    app = recording.appstats_wsgi_middleware(app)
    return app 
Example 10
Project: naziscore   Author: rbanffy   File: appengine_config.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
    if DEBUG:
        from google.appengine.ext.appstats import recording
        app = recording.appstats_wsgi_middleware(app)
    return app 
Example 11
Project: codenn   Author: sriniiyer   File: appengine_config.py    MIT License 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
    from google.appengine.ext.appstats import recording
    app = recording.appstats_wsgi_middleware(app)
    return app 
Example 12
Project: python-docs-samples   Author: GoogleCloudPlatform   File: appengine_config.py    Apache License 2.0 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
    from google.appengine.ext.appstats import recording
    app = recording.appstats_wsgi_middleware(app)
    return app 
Example 13
Project: meet-notes   Author: lipis   File: appengine_config.py    MIT License 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
  from google.appengine.ext.appstats import recording
  app = recording.appstats_wsgi_middleware(app)
  return app 
Example 14
Project: scrimmage-scoreboard   Author: ShySec   File: appengine_config.example.py    GNU General Public License v2.0 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
    from google.appengine.ext.appstats import recording
    app = recording.appstats_wsgi_middleware(app)
    return app 
Example 15
Project: birwaz   Author: manshar   File: appengine_config.py    MIT License 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
  from google.appengine.ext.appstats import recording
  app = recording.appstats_wsgi_middleware(app)
  return app 
Example 16
Project: addrest   Author: JBrVJxsc   File: appengine_config.example.py    MIT License 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
    from google.appengine.ext.appstats import recording
    app = recording.appstats_wsgi_middleware(app)
    return app 
Example 17
Project: electron-crash-reporter   Author: lipis   File: appengine_config.py    MIT License 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
  from google.appengine.ext.appstats import recording
  app = recording.appstats_wsgi_middleware(app)
  return app 
Example 18
Project: oppia   Author: google-code-export   File: appengine_config.py    Apache License 2.0 5 votes vote down vote up
def webapp_add_wsgi_middleware(app):
    """Add AppStats recording.

    This also sets the level of appstats log messages to 'debug' by
    monkey-patching. For details, see:

        https://stackoverflow.com/questions/4305243/disable-appstats-logging
    """
    from google.appengine.ext.appstats import recording

    def save(self):
        t0 = time.time()
        with self._lock:
            num_pending = len(self.pending)
        if num_pending:
            logging.warn('Found %d RPC request(s) without matching response '
                         '(presumably due to timeouts or other errors)',
                         num_pending)
        self.dump()
        try:
            key, len_part, len_full = self._save()
        except Exception:
            logging.exception('Recorder.save() failed')
            return
        t1 = time.time()
        link = 'http://%s%s/details?time=%s' % (
            self.env.get('HTTP_HOST', ''),
            recording.config.stats_url,
            int(self.start_timestamp * 1000))
        logging.debug('Saved; key: %s, part: %s bytes, full: %s bytes, '
                      'overhead: %.3f + %.3f; link: %s',
                      key, len_part, len_full, self.overhead, t1 - t0, link)

    recording.Recorder.save = save

    app = recording.appstats_wsgi_middleware(app)
    return app


# Root path of the app.