An Elixir client for DogStatsd
Switch branches/tags
Nothing to show
Clone or download
Latest commit e56ec36 Apr 18, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
config initial commit Nov 7, 2014
lib clean up warnings / update excoveralls Apr 18, 2017
test clean up warnings / update excoveralls Apr 18, 2017
.gitignore set up zenflow Nov 7, 2014
.travis.yml update travis Apr 18, 2017
.zenflow set up zenflow Nov 7, 2014 set up zenflow Nov 7, 2014 add license Nov 7, 2014 Update Dec 31, 2014
VERSION.yml version bump Apr 18, 2017
mix.exs add ex_doc Apr 18, 2017
mix.lock add ex_doc Apr 18, 2017


A client for DogStatsd, an extension of the StatsD metric server for Datadog.

Build Status Coverage Status

Quick Start Guide

First install the library:

  1. Add dogstatsd to your mix.exs dependencies:

    def deps do
        {:dogstatsd, "0.0.3"}
  2. Add :dogstatsd to your application dependencies:

    def application do
      [applications: [:dogstatsd]]

Then start instrumenting your code:

# Require the dogstatsd module.
require DogStatsd

# Configure DogStatsd.
{:ok, statsd} ="localhost", 8125)

# Increment a counter.
DogStatsd.increment(statsd, "page.views")

# Record a gauge 50% of the time.
DogStatsd.gauge(statsd, "", 123, %{sample_rate: 0.5})

# Sample a histogram
DogStatsd.histogram(statsd, "file.upload.size", 1234)

# Time a block of code
DogStatsd.time(statsd, "page.render") do

# Send several metrics at the same time
# All metrics will be buffered and sent in one packet when the block completes
DogStatsd.batch(statsd, fn(s) ->
  s.increment(statsd, "page.views")
  s.gauge(statsd, "", 123)

# Tag a metric.
DogStatsd.histogram(statsd, "query.time", 10, %{tags: ["version:1"]})

You can also post events to your stream. You can tag them, set priority and even aggregate them with other events.

Aggregation in the stream is made on hostname/event_type/source_type/aggregation_key.

# Post a simple message
DogStatsd.event(statsd, "There might be a storm tomorrow", "A friend warned me earlier.")

# Cry for help
DogStatsd.event(statsd, "SO MUCH SNOW", "Started yesterday and it won't stop !!", %{alert_type: "error", tags: ["urgent", "endoftheworld"]})


To suggest a feature, report a bug, or general discussion, head over here.

Change Log

  • 0.0.1
    • Initial release.


dogstatsd-elixir is a port of the Ruby DogStatsd client