Hot questions for Using Cassandra in dropwizard


I'm new to Java. While exploring the ways of monitoring Cassandra, I found out( that "Metrics in Cassandra are managed using the Dropwizard Metrics library". However, at several places I've read about Codahale Metrics which has got me confused regarding the difference/relationship between the two. Are these different libraries doing the same thing or is it that what's called as dropwizard metrics used to be called as Codahale Metrics earlier?


The Metrics library have changed its package naming with versions as its changed hands in ownership a bit


They are all same library but dropwizard is the more up to date version


I want to capture Dropwizard Metrics of my Cassandra cluster in my Java Program(I don't want to use JMX) and pass those values in JSON to some other server(which will use these values to generate alarms etc). I'm new in Java and would really appreciate if I can get some guidance. Are there any native Dropwizard APIs for collecting these metrics? Can you provide a sample Java code of using that API for fetching any metric for example? The reason for not using JMX is that I've read here that it's not recommended to try to gather metrics from production environment as JMX’s RPC API is fragile.


You can send metrics using available plugins for Metrics library, such as graphite, or ganglia...

To do this, you need to put .jar file for corresponding plugin into lib directory of Cassandra, add corresponding configuration file for plugin, modify Cassandra's jvm.options file with following line:


and restart Cassandra to pickup the changes.

There are several blog post on configuration of Cassandra to use custom metrics plugins that could provide more details: 1, 2.

You may also try to setup standard Metrics Servlets to do query - it should be configured almost the same way - add library & provide configuration


I want to fetch various metrics like read/write latency, disk utilisation etc. of each of my Cassandra nodes(without using JMX) as a JSON object. It seems to me that MetricsServlet, can do exactly that. However, I'm still not able to figure out, what all do I need to do in order to use it(metrics-servlets does not come with Cassandra). I'll appreciate if I can get some advice/sample code(for fetching any metric).


Cassandra is not a java web server, it doesnt support servlets. You would need to start a java web server in same JVM as Cassandra and load those servlets. While possible its probably a lot less work to just query the metrics via JMX and convert to JSON with an external application or to expose JMX via http with something like MX4J (what I would recommend)