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

Functions

count(metric)

Display current counter at given time

decrement(metric, val \\ 1)

Decrement metric by given val

increment(metric, val \\ 1)

Increment metric by given val

remove(metric, )

Reset counter

reset(metric)

Reset counter

start_link(metric)

Start a new Counter metric