VMStatsEx
This is a tiny wrapper on top of the awesome ferd/vmstats package which pushes a lot of useful metrics about the erlang runtime using the statix library to a StatsD server.
Installation
Include this in your
mix.exs. That's it you are ready to go. This pushes data to localhost:8125/udpdef deps do [ {:vmstats_ex, "~> 0.1.0"} ] endConfigure vmstats.
# vmstats default config: https://github.com/ferd/vmstats#configuration config :vmstats, sink: VMStatsEx.Sink sched_time: true, base_key: "vmstats", key_seperator: ".", interval: 1000, # in ms memory_metrics: [{total, total}, {processes_used, procs_used}, {atom_used, atom_used}, {binary, binary}, {ets, ets}]Configure statix to send data to your StatsD server
config :statix, prefix: "my_app", host: "localhost", port: 8125
Testing
Testing that you are metrics are being sent can be a pain sometimes, just run the following
script on your local computer and start an iex session with your project that uses vmstats_ex
and you should be able to see your metrics on Datadog.
# local datadog agent using docker
docker run \
--name dd-agent \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /proc/:/host/proc/:ro \
-v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \
-e DD_API_KEY=<YOUR_DATADOG_API_KEY> \
-e DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true \
-p 8125:8125/udp \
datadog/agent:latest