How to integrate riemann into dropwizard to capture metrics?

I have a dropwizard application that emits yammer metrics and can be tracked via a url like http: // localhost: 8081 / admin / metrics , which gives the result as jsons.

I want to send these monitors these indicators to riemann, and I have no idea how to start. I went through a riemann-java client that has a RiemannReporter class for yammer indicators, but I do not use it in my application.

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

+5
source share
1 answer

The RiemanReporter Builder in the Java Client Library takes the registry of dropwizard metrics in the constructor. It supports event tagging and converts bids into Riemann events. You can set the polling interval in the start method using 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 configuration to capture this output and write to the Riemann log:

 (streams (where (tag "YOUR_APPLICATION_TAG") #(info %))) 
+6
source

Source: https://habr.com/ru/post/1213324/


All Articles