Performance Monitoring Openerp

末鹿安然 提交于 2019-12-21 06:26:09

问题


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.


回答1:


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.




回答2:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!