Last active
August 29, 2015 14:23
-
-
Save miohtama/eff2ad079ba231ec4c3a to your computer and use it in GitHub Desktop.
Newrelic + Pyramid + uWSGI
This file contains 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
def wrap_wsgi_app(self, app): | |
"""Perform any necessary WSGI application wrapping. | |
Wrap WSGI application to another WSGI application e.g. for the monitoring support. By default support New Relic. | |
""" | |
if "NEW_RELIC_CONFIG_FILE" in os.environ: | |
# Wrap for New Relic | |
# libgcc_s.so.1 must be installed for pthread_cancel to work | |
import newrelic.agent | |
return newrelic.agent.wsgi_application()(app) | |
return app | |
def make_wsgi_app(self, sanity_check=True): | |
"""Create WSGI application from the current setup. | |
:param sanity_check: True if perform post-initialization sanity checks. | |
:return: WSGI application | |
""" | |
# Let pyramid Configurator create initial app | |
app = self.config.make_wsgi_app() | |
# Carry the initializer around so we can access it in tests | |
app.initializer = self | |
app = self.wrap_wsgi_app(app) | |
return app |
This file contains 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
# the below is required by new relic. be sure to monitor your system | |
# memory since we're enabling threads | |
# https://newrelic.com/docs/python/python-agent-and-uwsgi | |
# http://uwsgi-docs.readthedocs.org/en/latest/Options.html | |
enable-threads = true | |
single-interpreter = true | |
lazy-apps = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
limit-as it not compatible with New Relic