{% extends "redis_metrics/base.html" %} {% load url from future %} {% block content %}
Hi. Thanks for using django-redis-metrics. Read on below for tips on getting started.
If you discover any bugs, please submit an Issue.
Congratulations on installing redis_metrics
! Now, you can
start counting things with this handy bit of code:
from redis_metrics import metric
#...
def your_function():
...
metric('your-function')
Import the metric
function in your code, and you can start
recording arbitrary metrics. Any time the metric
function is
executed, your your-function metric will be incremented.
You can also record gauges in a similar manner. Gauges are a numeric snapshot of some value.
from redis_metrics import gauge
#...
def your_function():
...
# You calculate some value that's important to you
num = calculate_some_value()
# Then store it in a Gauge
gauge('some-value', num)
There are a couple of ways to view your metrics. Out of the box, you can view a list of metrics (You should see these to your left) as well as a list of all gauges using the links below:
There are also a number of template tags that allow you co customize where (and how) you view metrics or gauges.
Assuming you've defined a logins
metric, you can see the
details of the data using the metric_detail
template tag:
{% templatetag openblock %}metric_detail 'logins' {% templatetag closeblock %}
Assuming that you've defined a new-users
metric, you can
use the metric_history
template tag to view the its daily
(or hourly, weekly, monthly, yearly) values:
{% templatetag openblock %}load redis_metric_tags {% templatetag closeblock %}
{% templatetag openblock %}metric_history 'new-users' 'daily' {% templatetag closeblock %}
Finally, you can view the status of any gauge with the gauge
template tag:
{% templatetag openblock %} gauge 'pageviews' {% templatetag closeblock %}
{% endblock %}