metrex v0.2.0 Metrex.Meter

Meter metrics implementation. Timeseries counter approach to increment, decrement using unixtime stamp.

Examples

Static meters

Add list of meters into config.exs file to autostart meters:

config :metrex,
  meters: ["pageviews"],
  ttl: 900

On-demand meters

To create on-demand meters, you need to call start_link function:

# Initialize meter with []
Metrex.start_meter("special_clicks")

Meter operations

Meter operations are increment, decrement, count and dump:

# Increment a meter by 1
Metrex.Meter.increment("pageviews")

# Increment a meter by x(number)
Metrex.Meter.increment("pageviews", 5)

# Decrement a meter by 1
Metrex.Meter.decrement("pageviews")

# Decrement a meter by x(number)
Metrex.Meter.decrement("pageviews", 3)

# Get meter for unixtime
Metrex.Meter.count("pageviews", 1475452816)

# Dump meter map related to a metric
Metrex.Meter.dump("pageviews")

Summary

Functions

Display current counter at given time

Decrement metric by given val

Return all metric data

Increment metric by given val

Remove metric at the time

Reset all the metric data

Start a new Meter metric

Functions

count(metric, time)

Display current counter at given time

decrement(metric, val \\ 1)

Decrement metric by given val

dump(metric)

Return all metric data

increment(metric, val \\ 1)

Increment metric by given val

remove(metric, time)

Remove metric at the time

reset(metric)

Reset all the metric data

start_link(metric)

Start a new Meter metric