Bug 1169944 - Always install the New Relic package, not just on prod

For bug 1124278, we're going to want to sprinkle new relic annotations
around the codebase, so by always installing it, we save having to stub
these out in development/on Travis. It also seems wise to have prod
running as close to the same packages as in development.

Since NEW_RELIC_LICENSE_KEY isn't set locally, plus
NEW_RELIC_DEVELOPER_MODE is set to true, the New Relic agent doesn't
submit anything. See:
https://docs.newrelic.com/docs/agents/python-agent/installation-configuration/python-agent-configuration#developer_mode
This commit is contained in:
Ed Morley 2015-08-11 14:49:26 +01:00
Родитель ae89891150
Коммит f9ee81d999
6 изменённых файлов: 11 добавлений и 12 удалений

Просмотреть файл

@ -56,7 +56,7 @@ def update(ctx):
execfile(activate_script, dict(__file__=activate_script)) execfile(activate_script, dict(__file__=activate_script))
# Install requirements using peep, so hashes are verified. # Install requirements using peep, so hashes are verified.
with ctx.lcd(th_service_src): with ctx.lcd(th_service_src):
ctx.local('python2.7 bin/peep.py install -r requirements/common.txt -r requirements/prod.txt') ctx.local('python2.7 bin/peep.py install -r requirements/common.txt')
# Make the virtualenv relocatable since paths are hard-coded by default. # Make the virtualenv relocatable since paths are hard-coded by default.
ctx.local('virtualenv --relocatable venv') ctx.local('virtualenv --relocatable venv')
# Fix lib64 symlink to be relative instead of absolute. # Fix lib64 symlink to be relative instead of absolute.

Просмотреть файл

@ -38,6 +38,7 @@ export DATABASE_URL='mysql://${DB_USER}:${DB_PASS}@localhost/treeherder'
export DATABASE_URL_RO='mysql://${DB_USER}:${DB_PASS}@localhost/treeherder' export DATABASE_URL_RO='mysql://${DB_USER}:${DB_PASS}@localhost/treeherder'
export TREEHERDER_DEBUG='1' export TREEHERDER_DEBUG='1'
export TREEHERDER_DJANGO_SECRET_KEY='${DJANGO_SECRET_KEY}' export TREEHERDER_DJANGO_SECRET_KEY='${DJANGO_SECRET_KEY}'
export NEW_RELIC_DEVELOPER_MODE='True'
" "
} }

Просмотреть файл

@ -5,7 +5,6 @@
# HEROKU REQUIREMENTS # HEROKU REQUIREMENTS
-r requirements/common.txt -r requirements/common.txt
-r requirements/prod.txt
# Pylibmc must be in this file so that heroku knows it has to install # Pylibmc must be in this file so that heroku knows it has to install
# libmemcached when bootstrapping the containers. # libmemcached when bootstrapping the containers.

Просмотреть файл

@ -25,6 +25,9 @@ kombu==3.0.26
# sha256: Y9f3sUog8p90Mlpp5ttFkl6vbjoAPqtGwCNP0FCoyT8 # sha256: Y9f3sUog8p90Mlpp5ttFkl6vbjoAPqtGwCNP0FCoyT8
simplejson==3.7.3 simplejson==3.7.3
# sha256: WbUVu327zdMH-BesOIVOgIOev6M8XbeX9lRQeTyUXA0
newrelic==2.52.0.40
# Required by datasource # Required by datasource
# sha256: gRBAtkfl1WhvhNtBXv1pfmJQAIsRK2kJunesBZ4UDHQ # sha256: gRBAtkfl1WhvhNtBXv1pfmJQAIsRK2kJunesBZ4UDHQ
MySQL-python==1.2.5 MySQL-python==1.2.5

Просмотреть файл

@ -2,5 +2,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at http://mozilla.org/MPL/2.0/. # file, you can obtain one at http://mozilla.org/MPL/2.0/.
# sha256: WbUVu327zdMH-BesOIVOgIOev6M8XbeX9lRQeTyUXA0 # Delete this file once we've done at least one deploy after bug 1169944 (since update.py needed updating)
newrelic==2.52.0.40

Просмотреть файл

@ -10,12 +10,9 @@ and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting. this application via the ``WSGI_APPLICATION`` setting.
""" """
try:
import newrelic.agent import newrelic.agent
except ImportError:
newrelic = False
if newrelic: # The New Relic agent must be initialised before anything else is imported.
newrelic.agent.initialize() newrelic.agent.initialize()
import os import os
@ -42,7 +39,7 @@ application = get_wsgi_application()
# referenced by WHITENOISE_ROOT at the site root. # referenced by WHITENOISE_ROOT at the site root.
application = CustomWhiteNoise(application) application = CustomWhiteNoise(application)
if newrelic: # Wrap with the New Relic agent.
application = newrelic.agent.WSGIApplicationWrapper(application) application = newrelic.agent.WSGIApplicationWrapper(application)
# Fix django closing connection to MemCachier after every request: # Fix django closing connection to MemCachier after every request: