MetricsStatsd
metrics_statsd provides an Elixir wrapper around the Erlang metrics app
from Hackney and adds a reporting
module for Statsd.
Please note: This wrapper is suitable for version ~> 1.0.1 of metrics.
Installation
-
Add
metrics_statsdto your list of dependencies inmix.exs:
```elixir
def deps do
[{:metrics_statsd, "~> 1.0.1"}]
end
```-
Ensure
metrics_statsdis initialized before usage:
```elixir
Metrics.init() # uses statsd reporting by default
# OR specify the repoting module to use (e.g. the original Folsom module)
Metrics.init(:metrics_folsom)
```- Send metrics (examples)
```elixir
Metrics.increment "mycounter"
Metrics.time "mytimer", fn ->
# code to time
end
```Using the MetricsStatsD reporting module
MetricsStatsD uses Statix under the hood, so please
make sure to configure it to your liking, e.g.
config :statix,
host: "statsd",
port: 8125
prefix: "myapp",