metrex v0.2.0 Metrex.Counter
Counter metrics implementation
Examples
Static counters
Add list of counters into config.exs file to autostart counters:
config :metrex,
counters: ["pageviews"]
On-demand counters
To create on-demand counters, you need to call start_link
function:
# Initialize counter with 0
Metrex.start_counter("special_clicks")
Counter operations
Counter operations are increment, decrement and count:
# Increment a counter by 1
Metrex.Counter.increment("pageviews")
# Increment a counter by x(number)
Metrex.Counter.increment("pageviews", 5)
# Decrement a counter by 1
Metrex.Counter.decrement("pageviews")
# Decrement a counter by x(number)
Metrex.Counter.decrement("pageviews", 3)
# Get current counter
Metrex.Counter.count("pageviews")
Summary
Functions
Display current counter at given time
Decrement metric by given val
Increment metric by given val
Reset counter
Reset counter
Start a new Counter
metric