commit | ba150cd0ca3dae0e5a2e249356d21ee8d80b7b6a | [log] [tgz] |
---|---|---|
author | Benjamin Anderson <b@banjiewen.net> | Tue Feb 04 16:03:14 2014 -0800 |
committer | Robert Newson <rnewson@apache.org> | Tue Aug 19 14:48:31 2014 +0100 |
tree | bca4b1d9d9495b8cd2ceb78a3d309dec159c9749 | |
parent | 500e12079e96a87b5001a93e3243e0b8a3ac1867 [diff] |
Use loaded_applications/0 instead of which_applications/0 This prevents app boot order from determining which metrics are loaded and which aren't. We'd get them in the end anyway, but the reload interval is intentionally slow.
couch_stats is a simple statistics collection app for Erlang applications. Its core API is a thin wrapper around a stat storage library (currently Folsom,) but abstracting over that library provides several benefits:
All references to stat storage are in one place, so it's easy to swap the module out.
Some common patterns, such as tying a process's lifetime to a counter value, are straightforward to support.
Configuration can be managed in a single place - for example, it's much easier to ensure that all histogram metrics use a 10-second sliding window if those metrics are instantiated/configured centrally.
[atom()]
.counter
, gauge
, or histogram
.If you don‘t add your metric to a description file, your metric will be accessible via couch_stats:sample/1
, but it won’t be read by the stats collector and therefore won't be available to HTTP _stats
requests, etc.
Tell couch_stats to use your description file via application configuration.
Instrument your code with the helper functions in couch_stats.erl
.