Skip to content

Stats charts: send metrics to a group and chart them

Describes Stats 0.3.0.

Each stats group has a page that tells you how to send it data and draws a chart of what it has received.

Where to find it

Open Stats, then Groups, and click a group’s name (/admin/stats/groups/<id>). Creating or saving a group also brings you here. You need the Stats permission.

The header

The group’s name, its key and a status badge (active or paused). Edit opens the group’s form.

Collector endpoint

This card gives the port to send data to and an example command:

echo "metric.name 42 $(date +%s)" | nc <host> <port>

Each line is a metric name, a value and a Unix timestamp, in the Graphite plaintext format. Replace <host> with your server’s address. The card also says how labels are read: with the group’s template if it has one, otherwise from tag syntax (metric;label=value) or not at all.

The chart

Until the group has received anything, the page says No metrics recorded yet. Once the collector starts sending data, refresh to pick a metric here. Click Refresh once data is arriving.

Once there’s data, four menus control the chart. Each change redraws it at once:

  • Metric: which metric to show. The first one alphabetically is picked to begin with.
  • Range: Last hour, Last 24 hours (the default), Last 7 days or Last 30 days.
  • Bucket: how much time each point on the chart covers: 1 minute, 5 minutes (the default), 1 hour or 1 day.
  • Aggregation: how the values within a bucket become one point: Average (the default), Sum, Min, Max or Count.

If the data can’t be read, you see Could not load chart data.

What it doesn’t do

  • The chart doesn’t update by itself. Change a menu or reload the page to see new values.
  • New metric names appear in the Metric menu only after a page reload.
  • There’s no way to pick labels in the admin: the menus choose only the metric.
  • A paused group’s stored data can’t be charted. The page shows the “No metrics recorded yet” message until you resume the group.