Rheostat.Adapter behaviour (Rheostat v0.2.1) View Source

Link to this section Summary

Callbacks

Opens the connection to the StatsD-compatible server. The 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 increment/3 but subtracts value instead of adding it. For this reason value should be zero or negative.

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

Writes to the StatsD gauge identified by key.

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.

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 decrement/3 should be used for negative values.

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

Writes the given value to the StatsD set identified by key.

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

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

Link to this section Types

Specs

key() :: iodata()

Specs

on_send() :: :ok | {:error, term()}

Specs

options() :: [sample_rate: float(), tags: [String.t()]]

Link to this section Callbacks

Specs

connect(list()) :: :ok

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

Link to this callback

count(map, arg2, number)

View Source

Specs

count(map(), String.t(), number()) :: any()

Specs

decrement(key()) :: on_send()

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

Specs

decrement(key(), value :: number()) :: on_send()

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

Link to this callback

decrement(key, value, options)

View Source

Specs

decrement(key(), value :: number(), options()) :: on_send()

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

Examples

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

Specs

gauge(key(), value :: String.Chars.t()) :: on_send()

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

Link to this callback

gauge(key, value, options)

View Source

Specs

gauge(key(), value :: String.Chars.t(), options()) :: on_send()

Writes to the StatsD gauge identified by key.

Examples

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

Specs

histogram(key(), value :: String.Chars.t()) :: on_send()

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

Link to this callback

histogram(key, value, options)

View Source

Specs

histogram(key(), value :: String.Chars.t(), options()) :: on_send()

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

Examples

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

Specs

increment(key()) :: on_send()

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

Specs

increment(key(), value :: number()) :: on_send()

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

Link to this callback

increment(key, value, options)

View Source

Specs

increment(key(), value :: number(), options()) :: on_send()

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

Examples

iex> MyApp.Statix.increment("hits", 1, [])
:ok

Specs

measure(map(), String.t(), any()) :: any()
measure(String.t(), list(), any()) :: any()

Specs

sample(map(), String.t(), any()) :: any()

Specs

set(key(), value :: String.Chars.t()) :: on_send()

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

Link to this callback

set(key, value, options)

View Source

Specs

set(key(), value :: String.Chars.t(), options()) :: on_send()

Writes the given value to the StatsD set identified by key.

Examples

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

Specs

timing(key(), value :: String.Chars.t()) :: on_send()

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

Link to this callback

timing(key, value, options)

View Source

Specs

timing(key(), value :: String.Chars.t(), options()) :: on_send()

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

Examples

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