band v0.5.2 Band

Link to this section Summary

Functions

Opens the connection to the StatsD-compatible server

Decrements the StatsD counter identified by key by the given value

Writes to the StatsD gauge identified by key

Writes value to the histogram identified by key

Increments the StatsD counter identified by key by the given value

Measures the execution time of the given function and writes that to the StatsD timing identified by key

Writes the given value to the StatsD set identified by key

Writes the given value to the StatsD timing identified by key

Link to this section Functions

Opens the connection to the StatsD-compatible server.

The configuration is read from the configuration for the :statix application (both globally and per connection).

Callback implementation for Statix.connect/0.

Link to this function decrement(key, val \\ 1, options \\ [])

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> MyApp.Statix.decrement("open_connections", 1, [])
:ok

Callback implementation for Statix.decrement/3.

Link to this function gauge(key, val, options \\ [])

Writes to the StatsD gauge identified by key.

Examples

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

Callback implementation for Statix.gauge/3.

Link to this function histogram(key, val, options \\ [])

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

Callback implementation for Statix.histogram/3.

Link to this function increment(key, val \\ 1, options \\ [])

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> MyApp.Statix.increment("hits", 1, [])
:ok

Callback implementation for Statix.increment/3.

Link to this function measure(key, options \\ [], fun)

Measures the execution time of the given function and writes that to the StatsD timing identified by key.

This function returns the value returned by function, making it suitable for easily wrapping existing code.

Examples

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

Callback implementation for Statix.measure/3.

Link to this function set(key, val, options \\ [])

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

Examples

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

Callback implementation for Statix.set/3.

Link to this function start_link(config)
Link to this function timing(key, val, options \\ [])

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

value is expected in milliseconds.

Examples

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

Callback implementation for Statix.timing/3.