The dropwizard codahale metrics exporter for prometheus.
It is a simple framework in form of java agent for exporting dropwizard realtime metrics like Timer, Gauge and Histogram.
If you have dropwizard metrics being used for monitoring various kinds of information and then want to use it with prometheus, then exporting the metrics in the prometheus form would be difficult. This project which uses java agent to instrument your code so that the dropwizard metrics are converted into prometheus format and sent over to prometheus for easy visualization and alerting using the prometheus server.
The javaagent takes each method which has annotations such as Timed, Gauge, Counted, ExceptionMetered and inserts code specific to the prometheus where the different calculations are done and emitted to the port where prometheus scrapes the metric from. The prometheus java simple client is used to transform the codahale metrics into prometheus format.
The metric names are taken as classname.methodname.metricname
Annotations instrumented include:
Timed
Counted
Gauge
--> Each class will have a gauge metric and all the methods are which have gauge annotation
will appear as sub labels underneath the class metric in the prometheus.
ExceptionMetered
mvn clean package
will build the uber jar.
java -javaagent:/target/dropwizard-prometheus-0.0.1-SNAPSHOT.jar=prometheus.listener.port:1024\-cp '<path-to-your-class-files' \<your-main-class>or<jar>
will start the background jetty instance and starts reporting metrics to prometheus.
The listener port is a mandatory argument.
Dropwizard-Prometheus project is licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0