Prometheus client compatibility with Springboot 2.*?

579 views
Skip to first unread message

Clay Vass

unread,
Sep 9, 2022, 3:36:36 AM9/9/22
to Prometheus Users
Hi all I am sure this gets asked alot, but was unable to find a good answer online to my question.

Is the prometheus java client (https://github.com/prometheus/client_java) able to record & export metrics if I am measuring against a JVM application that depends on springboot 2.*?

Fabian Stäber

unread,
Sep 9, 2022, 3:45:18 AM9/9/22
to Prometheus Users
Hello Clay,

We do not have any auto-instrumentation for Spring Boot. The reason is that Spring Boot ships with Micrometer built-in. Micrometer provides a lot of useful out-of-the-box metrics, and it is easy to add custom metrics.

dependencies:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<scope>runtime</scope>
</dependency>

application.properties
management.endpoints.web.exposure.include=prometheus

I would recommend using Micrometer, as it ships with Spring Boot. If there's any reason why that doesn't work for you, let me know.

Fabian

On Fri, Sep 9, 2022 at 9:36 AM Clay Vass <clay...@gmail.com> wrote:
Hi all I am sure this gets asked alot, but was unable to find a good answer online to my question.

Is the prometheus java client (https://github.com/prometheus/client_java) able to record & export metrics if I am measuring against a JVM application that depends on springboot 2.*?

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/a0044a3a-13c8-4f59-88aa-efb8919196f7n%40googlegroups.com.

Clay Vass

unread,
Sep 24, 2022, 1:48:12 AM9/24/22
to Fabian Stäber, Prometheus Users
Fabian - 

I guess I am asking more of, can I use prometheus client with a java service built with springboot 2.*? 
I understand I cannot perform some auto instrumentation, but I would like to create histograms/gauges/counters, and expose those, both via the prometheus java client library. Is this possible if my service relies on springboot 2.*?

You received this message because you are subscribed to a topic in the Google Groups "Prometheus Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/prometheus-users/dTF-vFRged8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CAPX310jupfW1vPyhmMEM%2B2RfahXm-Cxe4a5txEN%2B2sQBNC5WYw%40mail.gmail.com.


--
Reply all
Reply to author
Forward
0 new messages