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
from __future__ import print_function | |
import wrapt | |
import time | |
import sys | |
class TimeModuleProxy(wrapt.ObjectProxy): | |
def __init__(self, module=time): | |
super(TimeModuleProxy, self).__init__(module) |
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
# Put this on module path in file newrelic_django_nap.py. | |
# | |
# In agent configuration file add: | |
# | |
# [import-hook:nap.publisher] | |
# enabled = true | |
# execute = newrelic_django_nap:instrument_django_nap_publisher | |
from newrelic.agent import (current_transaction, set_transaction_name, | |
FunctionTrace, callable_name, wrap_function_wrapper) |
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
Traceback (most recent call last): | |
File "test-env/bin/gunicorn", line 8, in <module> | |
load_entry_point('gunicorn==0.16.1', 'console_scripts', 'gunicorn')() | |
File "/Users/graham/Work/python_agent-1.10.X/test-env/lib/python2.6/site-packages/gunicorn/app/wsgiapp.py", line 32, in run | |
WSGIApplication("%prog [OPTIONS] APP_MODULE").run() | |
File "/Users/graham/Work/python_agent-1.10.X/test-env/lib/python2.6/site-packages/gunicorn/app/base.py", line 127, in run | |
Arbiter(self).run() | |
File "/Users/graham/Work/python_agent-1.10.X/test-env/lib/python2.6/site-packages/gunicorn/arbiter.py", line 162, in run | |
self.start() | |
File "/Users/graham/Work/python_agent-1.10.X/test-env/lib/python2.6/site-packages/gunicorn/arbiter.py", line 122, in start |
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) |
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
$ uwsgi --ini uwsgi.ini -M -p 2 --reload-mercy 3 | |
[uWSGI] getting INI configuration from uwsgi.ini | |
*** Starting uWSGI 1.4.1 (64bit) on [Fri Nov 23 14:43:05 2012] *** | |
compiled with version: 4.2.1 (Apple Inc. build 5666) (dot 3) on 22 November 2012 16:19:23 | |
os: Darwin-10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 | |
nodename: Grumpys-MacBook-Pro-15.local | |
machine: i386 | |
clock source: unix | |
detected number of CPU cores: 4 | |
current working directory: /Library/WebServer/Sites/hello-1/htdocs |
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
$ uwsgi --ini uwsgi.ini -M -p 2 --reload-mercy 3.0 | |
[uWSGI] getting INI configuration from uwsgi.ini | |
*** Starting uWSGI 1.4.1 (64bit) on [Fri Nov 23 14:40:25 2012] *** | |
compiled with version: 4.2.1 (Apple Inc. build 5666) (dot 3) on 22 November 2012 16:19:23 | |
os: Darwin-10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 | |
nodename: Grumpys-MacBook-Pro-15.local | |
machine: i386 | |
clock source: unix | |
detected number of CPU cores: 4 | |
current working directory: /Library/WebServer/Sites/hello-1/htdocs |
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
$ uwsgi --ini uwsgi.ini -p 2 | |
[uWSGI] getting INI configuration from uwsgi.ini | |
*** Starting uWSGI 1.4.1 (64bit) on [Fri Nov 23 14:35:44 2012] *** | |
compiled with version: 4.2.1 (Apple Inc. build 5666) (dot 3) on 22 November 2012 16:19:23 | |
os: Darwin-10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 | |
nodename: Grumpys-MacBook-Pro-15.local | |
machine: i386 | |
clock source: unix | |
detected number of CPU cores: 4 | |
current working directory: /Library/WebServer/Sites/hello-1/htdocs |
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
# Save this as newrelic-manage.py in same directory as existing manage.py. | |
# | |
# Run as: | |
# | |
# NEW_RELIC_CONFIG_FILE=/some/path/newrelic.ini python newrelic-manage.py run_gunicorn | |
import os | |
import newrelic.agent | |
here = os.path.dirname(__file__) |
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
(uwsgi-testing)Grumpys-MacBook-Pro-15:htdocs graham$ which python | |
/Users/graham/Python/uwsgi-testing/bin/python | |
(uwsgi-testing)Grumpys-MacBook-Pro-15:htdocs graham$ python | |
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) | |
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import sys | |
>>> sys.prefix | |
'/Users/graham/Python/uwsgi-testing/bin/..' |
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
843,httplib | |
843,urllib | |
813,urllib2 | |
163,requests | |
94,httplib2 | |
87,xmlrpclib | |
33,feedparser | |
6,urllib3 |