How well do you really understand the WSGI specification?
Web Frameworks
# Run this as: | |
# | |
# NEW_RELIC_CONFIG_FILE=newrelic.ini newrelic-admin run-python example.py | |
# | |
# If being run under Heroku, you can skip setting NEW_RELIC_CONFIG_FILE on the | |
# command line as the required environment variable settings added by the | |
# Heroku New Relic addon will be picked up automatically. | |
import time | |
import newrelic.agent |
def __eq__(self, other): | |
if isinstance(other, ObjectWrapper): | |
return self._nr_last_object == other._nr_last_object | |
return self._nr_last_object == other | |
def __ne__(self, other): | |
result = self.__eq__(other) | |
if result is NotImplemented: | |
return result | |
return not result |
# Import hooks for nova. | |
[import-hook:nova.wsgi] | |
enabled = true | |
execute = nova-api-instrumentation:instrument_nova_wsgi | |
[import-hook:nova.api.openstack.wsgi] | |
enabled = true | |
execute = nova-api-instrumentation:instrument_nova_api_openstack_wsgi |
import types | |
import sys | |
from newrelic.api.object_wrapper import callable_name | |
from newrelic.api.error_trace import wrap_error_trace | |
from newrelic.api.in_function import wrap_in_function | |
from newrelic.api.transaction_name import wrap_transaction_name | |
from newrelic.api.function_trace import wrap_function_trace, FunctionTraceWrapper | |
from newrelic.api.external_trace import wrap_external_trace | |
from newrelic.api.web_transaction import WSGIApplicationWrapper |
Sed in nulla eu est vestibulum convallis. Praesent ante magna, molestie vel porttitor vel, aliquet ut dolor. Proin molestie massa eu tellu.
I am lazy when it comes to searching though documentation on hosting providers web sites. HHG was therefore awesome for me as it brought all the important stuff I needed to know into one place. An indispensable quick reference guide.
I can be lazy when it comes to searching web documentation. HHG is awesome as it combines the important stuff I need to know in one place.
# This is correct. | |
import os, sys | |
sys.path.append('/usr/local/django') | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' | |
import django.core.handlers.wsgi | |
# This must be at global scope. | |
_application = django.core.handlers.wsgi.WSGIHandler() |
[import-hook:pyramid.router] | |
enabled = true | |
execute = newrelic.hooks.framework_pyramid:instrument_pyramid_router |
meta = getattr(instance, '_meta', None) | |
if meta is None: | |
group = 'Python/TastyPie/Api' | |
name = instance.api_name | |
elif meta.api_name is not None: | |
group = 'Python/TastyPie/Api' | |
name = '%s/%s/%s' % (meta.api_name, meta.resource_name, view_name) | |
else: | |
group = 'Python/TastyPie/Resource' |