
# Enable appstats and optionally cost calculation.
# Change these values and upload again if you want to enable appstats.
enable_appstats = False
appstats_CALC_RPC_COSTS = False


def webapp_add_wsgi_middleware(app):
  """Overrides the wsgi application with appstats if enabled.

  https://developers.google.com/appengine/docs/python/tools/appstats
  """
  if enable_appstats:
    # pylint: disable=E0611,F0401
    from google.appengine.ext.appstats import recording
    return recording.appstats_wsgi_middleware(app)

  return app


# The app engine headers are located locally, so don't worry about not finding
# them.
# pylint: disable=E0611,F0401
from google.appengine.api import app_identity
# pylint: enable=E0611,F0401


# Enable appstats and optionally cost calculation on a dev instance.
enable_appstats = app_identity.get_application_id().endswith('-dev')
appstats_CALC_RPC_COSTS = False


def webapp_add_wsgi_middleware(app):
  """Overrides the wsgi application with appstats if enabled.

  https://developers.google.com/appengine/docs/python/tools/appstats
  """
  if enable_appstats:
    # pylint: disable=E0611,F0401
    from google.appengine.ext.appstats import recording
    return recording.appstats_wsgi_middleware(app)

  return app

Enable app stats on '-dev' instance.
Enable app stats on '-dev' instance.

This will also enable them on local dev server as well since default app name
in app.yaml is 'isolateserver-dev'.

R=maruel@chromium.org

Review URL: https://codereview.appspot.com/13457054

  
+ # The app engine headers are located locally, so don't worry about not finding
+ # them.
+ # pylint: disable=E0611,F0401
+ from google.appengine.api import app_identity
+ # pylint: enable=E0611,F0401
+ 
+ 
- # Enable appstats and optionally cost calculation.
+ # Enable appstats and optionally cost calculation on a dev instance.
+ enable_appstats = app_identity.get_application_id().endswith('-dev')
- # Change these values and upload again if you want to enable appstats.
- enable_appstats = False
  appstats_CALC_RPC_COSTS = False
  
  
  def webapp_add_wsgi_middleware(app):
    """Overrides the wsgi application with appstats if enabled.
  
    https://developers.google.com/appengine/docs/python/tools/appstats
    """
    if enable_appstats:
      # pylint: disable=E0611,F0401
      from google.appengine.ext.appstats import recording
      return recording.appstats_wsgi_middleware(app)
  
    return app
  
Enable app stats on '-dev' instance.
## Code Before:

# Enable appstats and optionally cost calculation.
# Change these values and upload again if you want to enable appstats.
enable_appstats = False
appstats_CALC_RPC_COSTS = False


def webapp_add_wsgi_middleware(app):
  """Overrides the wsgi application with appstats if enabled.

  https://developers.google.com/appengine/docs/python/tools/appstats
  """
  if enable_appstats:
    # pylint: disable=E0611,F0401
    from google.appengine.ext.appstats import recording
    return recording.appstats_wsgi_middleware(app)

  return app

## Instruction:
Enable app stats on '-dev' instance.
## Code After:

# The app engine headers are located locally, so don't worry about not finding
# them.
# pylint: disable=E0611,F0401
from google.appengine.api import app_identity
# pylint: enable=E0611,F0401


# Enable appstats and optionally cost calculation on a dev instance.
enable_appstats = app_identity.get_application_id().endswith('-dev')
appstats_CALC_RPC_COSTS = False


def webapp_add_wsgi_middleware(app):
  """Overrides the wsgi application with appstats if enabled.

  https://developers.google.com/appengine/docs/python/tools/appstats
  """
  if enable_appstats:
    # pylint: disable=E0611,F0401
    from google.appengine.ext.appstats import recording
    return recording.appstats_wsgi_middleware(app)

  return app
