JVM agent instrumentation for Prometheus

259 views
Skip to first unread message

willf...@gmail.com

unread,
Sep 28, 2017, 4:05:15 PM9/28/17
to Prometheus Developers
I'm not sure if anyone in the community is interested or not, but I've written a JVM agent based instrumentation library for Prometheus. I was sick of polluting my code with metrics code and the delay in getting a new build through the pipeline just to add a new metric.

I've been involved in a very minor way in the Prometheus project early on via contributing the JMH microbenchmarks to the Java client project previously via @BrianBrazil.

The new agent library can be found here https://github.com/willfleury/prometheus-metrics-agent

The above is a specialisation of another more general agent library I wrote for metrics which supports systems other than Prometheus. I know Brian Brazil which is why I wrote the specialisation and contributed it. Its main features are

- injects the metric bytecode as if hand crafted
- configuration driven instrumentation
- annotation driven instrumentation
- dynamic label values based on method stack variables
- supports any language that runs on the JVM

If anyone wishes to fork it and maintain it etc, please do so. Its pretty well documented as it is, but I will not have enough free time to answer questions & bug fixes in a timely manner. I would happily help anyone getting started with it and improve documentation where necessary to ensure it was easy for others to take over.

I've used the original agent library on various projects, Dropwizard microservices in particular but I know there are users who have used it with Tomcat applications also.

willf...@gmail.com

unread,
Oct 2, 2017, 12:18:44 PM10/2/17
to Prometheus Developers
To help get people started and to see the benefit of a configuration driven agent based approach to metrics, I've added some sample configurations for some popular frameworks

- Tomcat (Servlet, JSP, Jersey)
- Dropwizard (Jersey)
- Hibernate

It is very easy to add new projects. The hibernate one in particular is an example of how you can replace the maintenance burden of projects such as the simpleclient_hibernate module currently maintained and support multiple versions with ease.

Checkout the examples at https://github.com/willfleury/prometheus-metrics-agent#examples

Reply all
Reply to author
Forward
0 new messages