dogstat v0.1.0 DogStat
This module provides helper functions to persist meaningful metrics to StatsD or DogstatsD servers.
Code is based on Statix library.
Summary
Functions
Changes DogStat configuration at run-time. Accepts opts
is identical to a start_link/1
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
Starts a metric collector process
Writes the given value
to the StatsD timing identified by key
Types
Functions
Changes DogStat configuration at run-time. Accepts opts
is identical to a start_link/1
.
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> decrement("open_connections", 1, [])
:ok
Writes value
to the histogram identified by key
.
Not all StatsD-compatible servers support histograms. An example of a such server statsite.
Examples
iex> histogram("online_users", 123, [])
:ok
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> increment("hits", 1, [])
:ok
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> measure("integer_to_string", [], fn -> Integer.to_string(123) end)
"123"
Writes the given value
to the StatsD set identified by key
.
Examples
iex> set("unique_visitors", "user1", [])
:ok
Starts a metric collector process.
opts
accepts connection arguments:
enabled?
- enables or disables metrics reporting;host
- StatsD server host;port
- StatsD server port;namespace
- will be used as prefix to collected metrics;send_tags?
- allows to disable tags for StatsD servers that don’t support them;sink
- if set to list, all metrics will be stored in a process state, useful for testing;