Rheostat v0.1.0 Rheostat View Source

A configurable stats provider. Rheostat provides a common interface to stats provider.

Configure the provider with:

config :rheostat, adapter: Rheostat.Adapter.Statix

Link to this section Summary

Functions

Opens the connection to the stats server. configuration is read from the configuration for the :statix application (both globally and per connection)

Same as decrement(key, 1, [])

Same as decrement(key, value, [])

Decrements the StatsD counter identified by key by the given value. Works same as c:increment/3 but subtracts value instead of adding it. For this reason value should be zero or negative.

Examples

iex> Rheostat.decrement("open_connections", 1, [])
:ok

Same as gauge(key, value, [])

Writes to the StatsD gauge identified by key.

Examples

iex> Rheostat.gauge("cpu_usage", 0.83, [])
:ok

Same as histogram(key, value, [])

Writes value to the histogram identified by key. Not all StatsD-compatible servers support histograms. An example of a such server statsite.

Examples

iex> Rheostat.histogram("online_users", 123, [])
:ok

Same as increment(key, 1, [])

Same as increment(key, value, [])

Increments the StatsD counter identified by key by the given value. value is supposed to be zero or positive and c:decrement/3 should be used for negative values

Measures the execution time of the given function and writes that to the timing identified by key. This function returns the value returned by function, making it suitable for easily wrapping existing code.

Examples

iex> Rheostat.measure("integer_to_string", [], fn -> Integer.to_string(123) end)
"123"

Same as set(key, value, [])

Writes the given value to the set identified by key.

Examples

iex> Rheostat.set("unique_visitors", "user1", [])
:ok

Same as timing(key, value, [])

Writes the given value to the timing identified by key. value is expected in milliseconds.

Examples

iex> Rheostat.timing("rendering", 12, [])
:ok

Link to this section Functions

Opens the connection to the stats server. configuration is read from the configuration for the :statix application (both globally and per connection).

Link to this function count(metadata, metric, num) View Source

Same as decrement(key, 1, []).

Same as decrement(key, value, []).

Link to this function decrement(key, value, options) View Source

Decrements the StatsD counter identified by key by the given value. Works same as c:increment/3 but subtracts value instead of adding it. For this reason value should be zero or negative.

Examples

iex> Rheostat.decrement("open_connections", 1, [])
:ok

Same as gauge(key, value, []).

Link to this function gauge(key, value, options) View Source

Writes to the StatsD gauge identified by key.

Examples

iex> Rheostat.gauge("cpu_usage", 0.83, [])
:ok

Same as histogram(key, value, []).

Link to this function histogram(key, value, options) View Source

Writes value to the histogram identified by key. Not all StatsD-compatible servers support histograms. An example of a such server statsite.

Examples

iex> Rheostat.histogram("online_users", 123, [])
:ok

Same as increment(key, 1, []).

Same as increment(key, value, []).

Link to this function increment(key, val, options) View Source

Increments the StatsD counter identified by key by the given value. value is supposed to be zero or positive and c:decrement/3 should be used for negative values.

Examples

iex> Rheostat.increment("hits", 1, [])
:ok
Link to this function measure(metadata, metric, target) View Source

Measures the execution time of the given function and writes that to the timing identified by key. This function returns the value returned by function, making it suitable for easily wrapping existing code.

Examples

iex> Rheostat.measure("integer_to_string", [], fn -> Integer.to_string(123) end)
"123"
Link to this function sample(metadata, metric, value) View Source

Same as set(key, value, []).

Link to this function set(key, value, options) View Source

Writes the given value to the set identified by key.

Examples

iex> Rheostat.set("unique_visitors", "user1", [])
:ok

Same as timing(key, value, []).

Link to this function timing(key, value, options) View Source

Writes the given value to the timing identified by key. value is expected in milliseconds.

Examples

iex> Rheostat.timing("rendering", 12, [])
:ok