This module implements a simple way of giving operational visibility
of events in the system. It expects a Key and Data where the
Key is used to increment a counter in a table and also to store the
last received Data for that Key. The Data is preferred to be a list
of {K,V} tuples, if it is any other format, it uses [{data, Data}]
to store the last information.
otter_lib_snapshot_count:sup_init() from a persistent process.
The simplest is to call from the application supervisor init. The call
only creaes the ETS tables that need an owner process to stay around.
| delete_all_counters/0 | Delete all counters and data (snapshot). |
| delete_counter/1 | Delete the counter and data (snapshot) for a key. |
| get_snap/1 | Return the last stored data (snapshot) for a key. |
| list_counts/0 | List all the counters with their values. |
| snapshot/2 | Increase a counter for the given Key and store the Data. |
| sup_init/0 | Initialize the ETS tables to store counters/snapshots. |
delete_all_counters() -> ok
Delete all counters and data (snapshot)
delete_counter(Key::term()) -> ok
Delete the counter and data (snapshot) for a key
get_snap(Key::term()) -> term()
Return the last stored data (snapshot) for a key
list_counts() -> [{Key::term(), Counter::integer()}]
List all the counters with their values
snapshot(Key::term(), Data::term()) -> integer()
Increase a counter for the given Key and store the Data. If the data
is a property (key-value) list then it adds the timestamp in
{Year, Month, Day, Hour, Min, Sec, Us} format to the list with key
snap_timestamp`. If it is not a property list then it stores the
data in a property list with key `data and adds the timestamp.
It returns the current counter value for the key.
sup_init() -> term()
Initialize the ETS tables to store counters/snapshots. Should be called from a persistent process/
Generated by EDoc, May 26 2017, 14:22:06.