What are counters?¶
Counter measurements¶
If you POST metrics as a counter, Librato will plot the derivative, i.e. the delta of values that monotonically increase over time. To learn how to track the derivative with a gauge read “Tracking the Derivative with Gauges” below.
Tracking the Derivative with Counters¶
Counters are designed for tracking an external data value that increases over time where the only method to observe it is to periodically grab a snapshot of the current value. For example, many routers will track the number of bytes transferred and received over each network port as metrics that increase over time until they are reset to zero – oftentimes only when the router is restarted. To observe the rate of traffic on the router you must grab snapshots of the byte counters at defined intervals and plot the difference over the time interval.
Librato counters are designed to map to these particular external counter metrics. A Librato counter is unbounded (up to 64 bits) and always monotonically increasing in any given run. A new run can be started by restarting the counter’s value at zero.
Counters are submitted to Librato as the snapshot value of the external metric. Once in Librato, counters are plotted as a set of deltas between any two points in the stream of measurements. Therefore, when you view the graph of a counter metric you see the rate of change of that counter value.
For example, if your counter POSTs these increasing values:
100, 200, 350, 400
… they will plot as
100, 150, 50
If you are able to track and record the individual increments and decrements to a counter, we recommend periodically submitting the aggregate of those changes over small time periods as a gauge and not a counter.
Tracking the Derivative with Gauges¶
You can track the rate of change of a gauge by creating a composite metric. As an example, you could track the rate of customer signups by using derive() to graph the derivative of a “total user count” metric.
derive(s("prod.myapp.users.count", "*"))
Documentation on the derive(set[], options={}) function is in the Composite Metrics Language Specification.
Counting events¶
If you are looking for incremental counters, please see How do I count events?.