https://github.com/edgurgel/verk-stats
Verk Stats 🧛📊
https://github.com/edgurgel/verk-stats
metrics stats verk
Last synced: 7 months ago
JSON representation
Verk Stats 🧛📊
- Host: GitHub
- URL: https://github.com/edgurgel/verk-stats
- Owner: edgurgel
- License: mit
- Created: 2016-12-12T04:42:46.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-07-22T02:45:43.000Z (about 7 years ago)
- Last Synced: 2024-10-17T13:40:42.304Z (about 1 year ago)
- Topics: metrics, stats, verk
- Language: Elixir
- Homepage: https://hex.pm/packages/verk_stats
- Size: 5.86 KB
- Stars: 4
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# VerkStats [](https://travis-ci.org/edgurgel/verk-stats)
Application that generate metrics about [Verk](https://github.com/edgurgel/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`:
```elixir
def deps do
[
{:verk_stats, "~> 1.0"}
]
end
```## Metrics
* `jobs.start` - `counter` - When a job was started
* `jobs.success` - `timing` - How long a job took to finish successfully.
* `jobs.success.total_fime` - `timing` - How long a job took to finish successfully counting from the time it was enqueued.
* `jobs.failure` - `timing` - How long it took for a job to finish unsuccessfully.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.
```elixir
defmodule VerkExample do
use Applicationdef start(_type, _args) do
import Supervisor.Spec, warn: falsechildren = [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`](https://github.com/lexmag/statix)(StatsD client):
```elixir
defmodule StatixSink do
@behaviour VerkStats.Sink
use Statixdef collect(:counter, key, value, tags) do
increment(key, value, tags: tags)
:ok
enddef collect(:timing, key, value, tags) do
timing(key, value, tags: tags)
:ok
end
end
```