Dropwizard Metrics integration in Ratpack-Java

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Dropwizard Metrics integration in Ratpack-Java

Five_Sigma
I'm trying to add dropwizard metrics to my ratpack server, but the few words here aren't even useful.

There's like nowhere to find how the native integration of Dropwizard Metrics in Ratpack works if you're working in Java instead of Groovy.

Could anybody give me some tips?

I'm not trying to do anything complex, just doing this:

ratpack {
  bindings {
    module new DropwizardMetricsModule(), { it.jmx().console() }
  }
}

in pure Java, to start with...

Thanks.
rus
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Dropwizard Metrics integration in Ratpack-Java

rus
The few words build on top of concepts already introduced.  You need to register a guice module and enable what you want through configuration.  

Once you have figured out how to do what you want, if you have any suggestions to improve the docs then please open an issue and send a PR.  Any updates to the docs are welcome.

The java version of your example would look like

RatpackServer.start(s -> s
    .registry(Guice.registry(bindings -> bindings
        .module(DropwizardMetricsModule.class, config -> config.jmx().console())
    ))
    ....
    ....
    ....

Hope that helps.
Loading...