Add docs for metrics and FakeRedis.pipeline

This commit is contained in:
Raphael Michel
2017-03-27 23:07:33 +02:00
parent a4ead5bd07
commit 8dacbe0fc6
2 changed files with 33 additions and 0 deletions

View File

@@ -68,5 +68,32 @@ to your data directory. As this might impact performance significantly and write
to disk, we recommend to only enable it for a small number of requests -- and only if you are to disk, we recommend to only enable it for a small number of requests -- and only if you are
really interested in the results. really interested in the results.
Available metrics
^^^^^^^^^^^^^^^^^
The metrics available in pretix follow the standard `metric types`_ from the Prometheus world.
Currently, the following metrics are exported:
pretix_view_requests_total
Counter. Counts requests to Django views, labeled with the resolved ``url_name``, the used
HTTP ``method`` and the ``status_code`` returned.
pretix_view_durations_seconds
Histogram. Measures duration of requests to Django views, labeled with the resolved
``url_name``, the used HTTP ``method`` and the ``status_code`` returned.
pretix_task_runs_total
Counter. Counts executions of background tasks, labeled with the ``task_name`` and the
``status``. The latter can be ``success``, ``error`` or ``expected-error``.
pretix_task_duration_seconds
Histogram. Measures duration of successful background task executions, labeled with the
``task_name``.
pretix_model_instances
Gauge. Measures number of instances of a certain model within the database, labeled with
the ``model`` name.
.. _metric types: https://prometheus.io/docs/concepts/metric_types/
.. _Prometheus: https://prometheus.io/ .. _Prometheus: https://prometheus.io/
.. _cProfile: https://docs.python.org/3/library/profile.html .. _cProfile: https://docs.python.org/3/library/profile.html

View File

@@ -27,6 +27,12 @@ class FakeRedis(object):
# bytes-conversion here for emulating redis behavior without making incr too hard # bytes-conversion here for emulating redis behavior without making incr too hard
return bytes(self.storage[rkey], encoding='utf-8') return bytes(self.storage[rkey], encoding='utf-8')
def pipeline(self):
return self
def execute(self):
pass
@override_settings(HAS_REDIS=True) @override_settings(HAS_REDIS=True)
def test_counter(monkeypatch): def test_counter(monkeypatch):