A Pluggable backend for StatsD to publish metrics to RabbitMQ. So instead of polling our data store for changes in metrics, We will get notified when there is a change through RabbitMQ.
Clone statsd
and our new backend
$ git clone https://github.com/statsd/statsd.git
$ git clone https://github.com/uptimedog/statsd-rabbitmq-backend.git statsd/backends/statsd-rabbitmq-backend
$ cd statsd
$ npm install
$ cd backends/statsd-rabbitmq-backend
$ npm install
$ cd ../..
Create a config file config.js
like the following to use rabbitmq backend. More options will be supported later
{
amqp: {
connection: "amqp://guest:guest@localhost:5672",
queue: "metrics",
durable: false
},
backends: [ "./backends/statsd-rabbitmq-backend" ]
}
Run statsd
daemon with that config file
$ node stats.js config.js
Start sending metrics
$ echo "foo:1|c" | nc -u -w0 127.0.0.1 8125
To run a simple consumer for testing
$ npm install amqplib
var q = 'metrics';
var open = require('amqplib').connect("amqp://guest:guest@localhost:5672");
// Consumer
open.then(function(conn) {
return conn.createChannel();
}).then(function(ch) {
return ch.assertQueue(q, {durable: false}).then(function(ok) {
return ch.consume(q, function(msg) {
if (msg !== null) {
console.log(msg.content.toString());
ch.ack(msg);
}
});
});
}).catch(console.warn);
$ node consumer.js
For transparency into our release cycle and in striving to maintain backward compatibility, statsd-rabbitmq-backend is maintained under the Semantic Versioning guidelines and release process is predictable and business-friendly.
See the Releases section of our GitHub project for changelogs for each release version of statsd-rabbitmq-backend. It contains summaries of the most noteworthy changes made in each release.
If you have any suggestions, bug reports, or annoyances please report them to our issue tracker at https://github.com/uptimedog/statsd-rabbitmq-backend/issues
If you discover a security vulnerability within statsd-rabbitmq-backend, please send an email to hello@clivern.com
We are an open source, community-driven project so please feel free to join us. see the contributing guidelines for more details.
© 2020, Uptimedog. Released under MIT License.
statsd-rabbitmq-backend is authored and maintained by @Uptimedog.