Hi,

 I'm trying to configure an app monitoring agent on a Pylons app, so
the recommended setup is to initialize the agent before all modules import,
and also  create a middleware class to collect stats on each request. I
have the following setup working but there's the potential risk for the
monitoring agent being initialized twice and the agent not working as
intended. Any pointers on how to take a better approach?.


import newrelic.agent
*
*
#class in config/middleware.py

class NewRelicAgent(object):
    def __init__(self, app):
        self.app = app
        newrelic.agent.initialize('/path/to/file/newrelic.ini')

    @newrelic.agent.wsgi_application()
    def __call__(self, environ, start_response):
        return self.app(environ, start_response)

#config/middleware.py make_app def

app = NewRelicAgent(app)

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to