I'm using the Django framework (version 1.5.1) with almost 25 inner apps, each with an avarage of 7 to 15 diferent views, quite a lot.
So to monitorize the RPM, query time, etc. . . and optime the code response I'm using the New Relic (free) service and it's very usetfull, BUT to monitorize the response time of a template/request it makes a javascript injection to the page before loading it.
Normaly it's not bad thing , unless your send email on a daily basis with a html rendered page, them it's hell on earth because the js injected in the html literary eats/destroys the html.
If your sending these mail by hand then maybe you can verify the content before sending it, but in my case it's a crontab taks, so that isn't a solution for me .
In the oficial docs there the disable_browser_autorum function that's just what I need, BUT (again) you can use the newrelic.disable_browser_autorum variable in a WSGI server, but I'm runnign a gunicorn server with supervisord, so that's not good.
But there also the newrelic.agent.disable_browser_autorum(flag=True) variable that you have to insert in your framework view and works together with the html quotes.
{% load staticfiles newrelic_tags %}
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE }}">
<head>
<meta charset="utf-8" />
{% newrelic_browser_timing_header %}
<body>
.
.
.
{% newrelic_browser_timing_footer %}
</body>
</html>
But there's no info on how to do it, and I've also did tests on my own to try and figure how to work it.
I'm not a big developer of python or django but out of experience it must be something like
class EmailView(DetailView):
template_name = 'email/daily-newsletter.html'
model = News
def get_queryset(self):
return News.objects.filter(date=datetime.date.today())
def get_context_data(self, **kwargs):
context = super(EmailView, self).get_context_data(**kwargs)
context['related_news'] = NewsRelated.objects.get(related=self.id)
>> HERE DO SOMETHING LIKE self.request.something =newrelic.agent.disable_browser_autorum(flag=True)<<
return context
Can anybody give me a hand with this? Any suggestion is welcommed.
PS: I've already posted a question on the official New Relic comunity, but with no luck so far.