NewRelic is a performance analysis service with support for python instrumentation. It supports several python web frameworks out of the box, but not TurboGears. So all TG web requests are lumped together under one "RootController" heading which isn't very useful. We've found a simple monkey patch approach with the NewRelic API solves this, and thought others who use TG and New Relic might want to use it also. (We are using TG 2.1.5 so I can't say for sure if this works with other versions)
Here's the code: https://sourceforge.net/p/allura/git/ci/ed4a5a0e804c60eebf9bed8c359b5f6acf91558a/tree/Allura/allura/lib/patches.py#l77 def newrelic(): old_call = tg.controllers.DecoratedController._call @h.monkeypatch(tg.controllers.DecoratedController, tg.controllers.decoratedcontroller.DecoratedController) def _call(self, controller, *args, **kwargs): '''Set NewRelic transaction name to actual controller name''' import newrelic.agent newrelic.agent.set_transaction_name(newrelic.agent.callable_name(controller)) return old_call(self, controller, *args, **kwargs) And that uses a monkeypatch helper which is defined as: https://sourceforge.net/p/allura/git/ci/ed4a5a0e804c60eebf9bed8c359b5f6acf91558a/tree/Allura/allura/lib/helpers.py#l97 def monkeypatch(*objs): def patchem(func): for obj in objs: setattr(obj, func.__name__, func) return patchem -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/turbogears?hl=en. For more options, visit https://groups.google.com/groups/opt_out.

