We are trying to implement new relic ( http://www.newrelic.com ) on a dev server to test openerp's performance .
The below installation steps of newrelic asks us to to modify WSGI application file . I am new to openerp and I can't seem to figure this out. Any help will be highly appreciated.
Within the same WSGI application file, you then need to add a wrapper around the actual WSGI application entry point. If the WSGI application entry point is a function declared in the file itself, then you can use a decorator.
@newrelic.agent.wsgi_application()
def application(environ, start_response):
...
If the WSGI application entry point is a function or object imported from a different module, then you can wrap it in pre decorator style.
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
application = newrelic.agent.wsgi_application()(application)
You should then restart the specific WSGI hosting mechanism you are using to reload the WSGI script file or module.
When we tested new relic it was too much effort to patch the WSGI handlers (of which there are a few). However, running the server under gunicorn using the new relic instructions and monitoring worked with no code changes required at all.
I don't know anything about WSGI, but this method in server/openerp/wsgi/core.py
looks promising.
def wsgi_xmlrpc_1(environ, start_response):
""" The main OpenERP WSGI handler."""
if environ['REQUEST_METHOD'] == 'POST' and environ['PATH_INFO'].startswith(
XML_RPC_PATH_1):
length = int(environ['CONTENT_LENGTH'])
data = environ['wsgi.input'].read(length)
You also might find the blog post on Gunicorn relevant.
来源:https://stackoverflow.com/questions/10497116/performance-monitoring-openerp