Metric reference¶
Every transcript here was recorded by running the code. They’re
regenerated by tox -e docs-assets and compared against these files
by tests/docs_examples, so a name that changes fails a test before
it misleads you.
How a name is built¶
<STATSD_PREFIX>.<middleware prefix>.<method>.<view path>.<metric>
myproject view get myproject.views.search total
celery.status.* is the exception and carries no prefix.
On the wire¶
statsd’s own format, as django-statsd hands it over:
# One request, as handed to statsd
myproject.view.http_codes.hit 1|c
myproject.view.http_codes.2xx 1|c
myproject.view.get.myproject.views.search.process_request 0.01096725|ms
myproject.view.get.myproject.views.search.process_view 0.00309944|ms
myproject.view.get.myproject.views.search.json.dumps 0.00596046|ms
myproject.view.get.myproject.views.search.build_queryset 0.00905991|ms
myproject.view.get.myproject.views.search.process_response 0.02908707|ms
myproject.view.get.myproject.views.search.total 0.09489059|ms
myproject.view.get.myproject.views.search.hit 1|c
myproject.view.site.hit 1|c
1|c is a counter increment and |ms a timing in milliseconds.
Those durations came from one run on one machine. Read the shape, and
measure the numbers on your own.
Per request¶
# GET /dashboard/
myproject.view.get.myproject.views.dashboard.hit
myproject.view.get.myproject.views.dashboard.process_request
myproject.view.get.myproject.views.dashboard.process_response
myproject.view.get.myproject.views.dashboard.process_view
myproject.view.get.myproject.views.dashboard.total
myproject.view.http_codes.2xx
myproject.view.http_codes.hit
myproject.view.site.hit
When the view raises¶
# GET /broken/, which raises
myproject.view.get.myproject.views.broken.hit
myproject.view.get.myproject.views.broken.process_exception
myproject.view.get.myproject.views.broken.process_request
myproject.view.get.myproject.views.broken.process_response
myproject.view.get.myproject.views.broken.process_view
myproject.view.get.myproject.views.broken.total
myproject.view.http_codes.5xx
myproject.view.http_codes.hit
myproject.view.site.hit
With database timing on¶
# GET /orders/ with STATSD_TRACK_DATABASE on
myproject.view.get.myproject.views.orders.hit
myproject.view.get.myproject.views.orders.process_request
myproject.view.get.myproject.views.orders.process_response
myproject.view.get.myproject.views.orders.process_view
myproject.view.get.myproject.views.orders.sql.default
myproject.view.get.myproject.views.orders.total
myproject.view.http_codes.2xx
myproject.view.http_codes.hit
myproject.view.site.hit
Celery¶
# One task, run and then failed
celery.status.task_failure
celery.status.task_postrun
celery.status.task_prerun
myproject.celery.myproject.tasks.send_invoice.hit
myproject.celery.myproject.tasks.send_invoice.total
myproject.celery.site.hit
Your own timers¶
# GET /search/ and GET /checkout/
myproject.view.get.myproject.views.checkout.hit
myproject.view.get.myproject.views.checkout.payment.attempt
myproject.view.get.myproject.views.checkout.payment.authorise
myproject.view.get.myproject.views.checkout.process_request
myproject.view.get.myproject.views.checkout.process_response
myproject.view.get.myproject.views.checkout.process_view
myproject.view.get.myproject.views.checkout.total
myproject.view.get.myproject.views.search.build_queryset
myproject.view.get.myproject.views.search.hit
myproject.view.get.myproject.views.search.json.dumps
myproject.view.get.myproject.views.search.process_request
myproject.view.get.myproject.views.search.process_response
myproject.view.get.myproject.views.search.process_view
myproject.view.get.myproject.views.search.total
myproject.view.http_codes.2xx
myproject.view.http_codes.hit
myproject.view.site.hit
Patched libraries¶
# 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