Home

Awesome

VerkStats Build Status

Application that generate metrics about Verk jobs & queues through a sink (logs, statsd)

Installation

The package can be installed by adding verk_stats to your list of dependencies in mix.exs:

def deps do
  [
    {:verk_stats, "~> 1.0"}
  ]
end

Metrics

Every metric will have tags "worker:NameOfWorker" & "queue:NameOfTheQueue"

Usage

Add VerkStats to your supervision tree after Verk.Supervisor has been started.

Example using LoggerSink as sink.

defmodule VerkExample do
  use Application

  def start(_type, _args) do
    import Supervisor.Spec, warn: false

    children = [supervisor(Verk.Supervisor, []), {VerkStats, VerkStats.LoggerSink}]

    opts = [strategy: :one_for_one, name: VerkExample.Supervisor]
    Supervisor.start_link(children, opts)
  end
end

The LoggerSink will log all metrics. Here's an example of a sink using Statix(StatsD client):

defmodule StatixSink do
  @behaviour VerkStats.Sink
  use Statix

  def collect(:counter, key, value, tags) do
    increment(key, value, tags: tags)
    :ok
  end

  def collect(:timing, key, value, tags) do
    timing(key, value, tags: tags)
    :ok
  end
end