Created
December 19, 2012 23:22
-
-
Save GrahamDumpleton/4341587 to your computer and use it in GitHub Desktop.
Manual method for optionally initialising agent based on environment variables.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this at start of WSGI file before any imports, but if necessary after setting | |
# sys.path so that 'newrelic' package can be found. | |
import os | |
license_key = os.environ.get('NEW_RELIC_LICENSE_KEY', None) | |
config_file = os.environ.get('NEW_RELIC_CONFIG_FILE', None) | |
environment = os.environ.get('NEW_RELIC_ENVIRONMENT', None) | |
if license_key or config_file: | |
import newrelic.agent | |
newrelic.agent.initialize(config_file, environment) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment