Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to integrate riemann into the dropwizard to capture metrics?

I have a dropwizard application which emits yammer metrics and can be monitored via a URL like http://localhost:8081/admin/metrics which gives the result in form of jsons.

I want to send these monitor these metrics in riemann and I have no idea on how to start. I went through the riemann-java-client which has a RiemannReporter class for yammer metrics but I do not how to use this in my application.

How to integrate this client into my application or how to capture jsons from the url and send these as events to riemann server?

like image 609
Santosh Tulasiram Avatar asked Feb 13 '15 13:02

Santosh Tulasiram


1 Answers

The RiemanReporter Builder in the Java Client Library takes the dropwizard metrics registry into the constructor. It supports tagging the events and it will convert the rates into Riemann events. You can set the polling interval on the start method with a TimeUnit

        Riemann riemann = new Riemann("YOUR_RIEMANN_HOST", 5555);
        ArrayList<String> tags = new ArrayList<String>();
        tags.add("YOUR_APPLICATION_TAG");
        RiemannReporter.Builder builder = RiemannReporter.forRegistry(environment.metrics()).tags(tags);
        RiemannReporter riemannReporter = builder.build(riemann);
        riemannReporter.start(1, TimeUnit.SECONDS);

Riemann config to trap this output and write to the Riemann log:

(streams (where (tag "YOUR_APPLICATION_TAG") #(info %)))
like image 131
barrymac Avatar answered Oct 07 '22 02:10

barrymac