exmetrics v1.1.0 Exmetrics.Gauge

Gauges measure numeric values of a metric at the current point in time.

e.g. "currently active threads"

Summary

Functions

Get the value of a gauge

Remove a gauge from the metrics collection

Set a gauge to return the value of a lazy evaluated function

Functions

get(name)

Specs

get(String.t) :: integer | nil

Get the value of a gauge.

iex> Exmetrics.Gauge.set "bar", 10
:ok
iex> Exmetrics.Gauge.get "bar"
10

iex> Exmetrics.Gauge.get "doesnt_exist"
nil
remove(name)

Specs

remove(String.t) :: atom

Remove a gauge from the metrics collection.

iex> Exmetrics.Gauge.set "to_be_removed", 10
:ok
iex> Exmetrics.Gauge.get "to_be_removed"
10
iex> Exmetrics.Gauge.remove "to_be_removed"
:ok
iex> Exmetrics.Gauge.get "to_be_removed"
nil
set(name, func)

Specs

set(String.t, integer) :: atom
set(String.t, function) :: atom

Set a gauge to return the value of a lazy evaluated function.

iex> Exmetrics.Gauge.set "foo_fn", fn -> 1 end
:ok
iex> Exmetrics.Gauge.get "foo_fn"
1

Set a gauge to a certain value.

iex> Exmetrics.Gauge.set "foo", 1
:ok
iex> Exmetrics.Gauge.get "foo"
1