What are counters?¶
Counter measurements¶
There are two common ways of counting things:
- The metric always submits the current state of an ever increasing counter
- The metric submits a “1” for every event
Tracking the Derivative¶
Tracking the derivate is useful if your metric is a counters that tracks 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.
Counters are submitted to Librato as the snapshot value of the external metric. For example, your counter may POSTs these increasing values:
100, 200, 350, 400
You can track the rate of change of a the metric by creating a composite using the derive() function. The data will then plot as:
100, 150, 50
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?.