{% extends "redis_metrics/base.html" %}

{% block titletext %}Hi, there!{% endblock %}
{% block breadcrumb %}
    <li class="active">Welcome!</li>
{% endblock %}

{% block content %}
    <p class="lead">Thank you for using
    <a href="https://github.com/bradmontgomery/django-redis-metrics">
    django-redis-metrics</a>. Read on for tips on getting started or visit the
    <a href="http://django-redis-metrics.readthedocs.io/en/latest/">documentation</a>.
    If you discover any bugs, please submit an
    <a href="https://github.com/bradmontgomery/django-redis-metrics/issues">
    Issue on Github</a>.</p>
    <hr/>

    <h2>Getting Started</h2>
    <p>Congratulations on installing <code>redis_metrics</code>! Now, you can
    start counting things with this handy bit of code:</p>

    <pre><code>
    from redis_metrics import metric

    #...

    def your_function():
        ...

        metric('your-function')
    </code></pre>

    <p>Import the <code>metric</code> function in your code, and you can start
    recording arbitrary metrics. Any time the <code>metric</code> function is
    executed, your <code>your-function</code> metric will be incremented.</p>

    <p>You can also record gauges in a similar manner. Gauges are a numeric
    <em>snapshot</em> of some value.</p>
    <pre><code>
    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)
    </code></pre>

    <h2>Viewing Metrics</h2>
    <p>There are a couple of ways to view your metrics. Out of the box, you
    can view a list of metrics (<em>You should see these to your left</em>)
    as well as a list of all gauges using the links below:</p>
    <ul>
        <li><a href="{% url 'redis_metrics_list' %}">Metrics List</a></li>
        <li><a href="{% url 'redis_metrics_gauges' %}">Gauges List</a></li>
    </ul>

    <p>There are also a number of template tags that allow you co customize
    where (and how) you view metrics or gauges.</p>

    <h3>Metric Detail</h3>
    <p>Assuming you've defined a <code>logins</code> metric, you can see the
    details of the data using the <code>metric_detail</code> template tag:</p>
    <pre><code>
    {% templatetag openblock %} metric_detail 'logins' {% templatetag closeblock %}
    </code></pre>

    <h3>Metric History</h3>
    <p>Assuming that you've defined a <code>new-users</code> metric, you can
    use the <code>metric_history</code> template tag to view the its daily
    (or hourly, weekly, monthly, yearly) values:</p>
    <pre><code>
    {% templatetag openblock %} load redis_metric_tags {% templatetag closeblock %}
    {% templatetag openblock %} metric_history 'new-users' 'daily' {% templatetag closeblock %}
    </code></pre>

    <h3>Gauges</h3>
    <p>Finally, you can view the status of any gauge with the <code>gauge</code>
    template tag:</p>
    <pre><code>
    {% templatetag openblock %} gauge 'pageviews' {% templatetag closeblock %}
    </code></pre>

{% endblock %}
