Patched libraries¶
Three things get timed whether or not you ask, because they’re the usual suspects behind a view that is slow for no visible reason.
# GET /report/, which renders a template
myproject.view.get.myproject.views.render_report.hit
myproject.view.get.myproject.views.render_report.process_request
myproject.view.get.myproject.views.render_report.process_response
myproject.view.get.myproject.views.render_report.process_view
myproject.view.get.myproject.views.render_report.render_django
myproject.view.get.myproject.views.render_report.total
myproject.view.http_codes.2xx
myproject.view.http_codes.hit
myproject.view.site.hit
render_django is the template render, nested under the view that
rendered it.
json¶
django_statsd.json wraps json.load(), json.loads(),
json.dump() and json.dumps(), and reports them as
json.<function>. Serialising a large response is easy to overlook
and is occasionally the entire answer.
Templates¶
django_statsd.templates wraps
django.template.loader.render_to_string and reports
render_django. Rendering happens inside the view timing, so this
tells you how much of the view was the template.
redis¶
django_statsd.redis subclasses redis.Redis and times
each command as redis.<command> in lower case, so a PING
arrives as redis.ping. It replaces redis.Redis itself, so
clients you build afterwards are timed without any change on your side.
Each patch checks a marker before it runs, so importing django-statsd twice doesn’t wrap anything twice. None of them need configuration, and a library that isn’t installed is skipped.