Awesome
Opencensus Prometheus integration for Erlang/BEAM
Copyright (c) 2018 Ilya Khaprov <i.khaprov@gmail.com>.
Version: 0.3.1
Opencensus: Erlang stats collection and distributed tracing framework.
Prometheus.io: monitoring system and time series database client in Erlang.
Using
Opencensus has trace and stats packages, trace package if for distributed tracing and stats package is for backend-agnostic metrics collection.
This library implements a trace reporter
for exporting spans duration as prometheus metrics and
a stats exporter
for exporting metrics collected using Opencensus.
Example configuration:
{opencensus, [
{reporter, {oc_reporter_sequential, [
{oc_reporter_zipkin, [
{url, "http://localhost:9411"},
{service_name, "service_name"}
]},
{oc_prometheus_reporter, [{type, histogram}, %% metric type
{name, span_histogram_seconds}, %% metric name, note the time unit
{buckets, [0, 1, 2]}]} %% histogram buckets with bounds in the time unit
]}},
{sampler, {oc_sampler_probability, [
{probability, 0.001} %% one in a thousand
]}}
]}
Since Prometheus uses push model you don't need to set up Opencensus stats exporter as usual.
Instead, this library provides oc_stat_exporter_prometheus
which implements Prometheus collector interface.
prometheus_registry:register_collector(oc_stat_exporter_prometheus)
Other Prometheus and Opencensus Links
Opencensus
Prometheus
- Cowboy1/2 Exporters and Cowboy2 instrumenter
- Ecto Instrumenter
- Elixir client
- Elixir plugs Instrumenters and Exporter
- Extatus - App to report metrics to Prometheus from Elixir GenServers
- Fuse plugin
- Inets HTTPD Exporter
- OS process info Collector (linux, freebsd, macos)
- Phoenix Instrumenter
- RabbitMQ Exporter.
Contributing
Section order:
- Types
- Macros
- Callbacks
- Public API
- Deprecations
- Private Parts
Install the git
pre-commit hook:
./bin/pre-commit.sh install
The pre-commit check can be skipped by passing --no-verify
to git commit
.
License
MIT