Rheostat v0.1.0 Rheostat.Adapter behaviour 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.

Examples

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

Same as gauge(key, value, [])

Writes to the StatsD gauge identified by key.

Examples

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

Examples

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

Same as set(key, value, [])

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

Examples

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

Same as timing(key, value, [])

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

Examples

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

Link to this section Types

Link to this type on_send() View Source
on_send() :: :ok | {:error, term()}
Link to this type options() View Source
options() :: [sample_rate: float(), tags: [String.t()]]

Link to this section Callbacks

Link to this callback connect() View Source
connect() :: :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, arg1, number) View Source
count(map(), String.t(), number()) :: any()
Link to this callback decrement(key) View Source
decrement(key()) :: on_send()

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

Link to this callback decrement(key, value) View Source
decrement(key(), value :: number()) :: on_send()

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

Link to this callback decrement(key, value, options) View Source
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
Link to this callback gauge(key, value) View Source
gauge(key(), value :: String.Chars.t()) :: on_send()

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

Link to this callback gauge(key, value, options) View Source
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
Link to this callback histogram(key, value) View Source
histogram(key(), value :: String.Chars.t()) :: on_send()

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

Link to this callback histogram(key, value, options) View Source
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
Link to this callback increment(key) View Source
increment(key()) :: on_send()

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

Link to this callback increment(key, value) View Source
increment(key(), value :: number()) :: on_send()

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

Link to this callback increment(key, value, options) View Source
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
Link to this callback measure(map, arg1, any) View Source
measure(map(), String.t(), any()) :: any()
measure(String.t(), list(), any()) :: any()
Link to this callback sample(map, arg1, any) View Source
sample(map(), String.t(), any()) :: any()
Link to this callback set(key, value) View Source
set(key(), value :: String.Chars.t()) :: on_send()

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

Link to this callback set(key, value, options) View Source
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
Link to this callback timing(key, value) View Source
timing(key(), value :: String.Chars.t()) :: on_send()

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

Link to this callback timing(key, value, options) View Source
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