3

I have 2 things:

  1. A java application.
  2. Prometheus server

My task is gather application metrics and send then to Prometheus.

I've found only 1 way to do it: using Micrometer. And as a java application it is convenient to take spring boot because it has a good integration with Micrometer and latter has adapter for Prometheus.

Are there any other options ?

P.S. I try to achieve it via dropwizard metrics but I am stuck - there almost no information in google about it.

gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
  • See [metrics to prometheus java](https://github.com/DataStax-Examples/metrics-to-prometheus-java) ,[the four types of prometheus metrics](https://tomgregory.com/the-four-types-of-prometheus-metrics/), [this](https://grafana.com/blog/2022/04/26/set-up-and-observe-a-spring-boot-application-with-grafana-cloud-prometheus-and-opentelemetry/), and [this](https://www.tutorialworks.com/spring-boot-prometheus-micrometer/) which may help. – I_Al-thamary Jun 28 '22 at 21:25
  • I have changed them. – I_Al-thamary Jun 28 '22 at 21:29
  • @I_Al-thamary If I am not mistaken 3 links use Micrometer. Not sure about it: https://grafana.com/blog/2022/04/26/set-up-and-observe-a-spring-boot-application-with-grafana-cloud-prometheus-and-opentelemetry/ Have you tried it ? – gstackoverflow Jun 28 '22 at 21:35
  • I would appreciate the whole example – gstackoverflow Jun 28 '22 at 21:43
  • Micrometer can work without Spring Boot. Can you post what you have tried? Perhaps you are trying to PUSH metrics to Prometheus instead of using the typical PULL model? – checketts Jun 29 '22 at 08:46
  • @checkett I have a bit different aim - I want to expose metrics for Prometheus from java application **without** Micrometer – gstackoverflow Jun 29 '22 at 09:00
  • You could use the Prometheus client directly, but it isn't clear why Micrometer is causing you problems. (https://github.com/prometheus/client_java) – checketts Jun 29 '22 at 11:36
  • @checketts I try to do exactly that but I can't. Could you please take a look ? https://stackoverflow.com/questions/72800851/how-to-export-metrics-collected-by-dropwizard-in-prometheus-format-from-java-a Micrometer is very good software but I need to create 2 applications: 1. with micrometer and 2. WIthout micrometer First one is reasy but the second one is not – gstackoverflow Jun 29 '22 at 11:45
  • Good example could be found here: https://stackoverflow.com/a/72802084/2674303 – gstackoverflow Jun 30 '22 at 12:14
  • So you have Prometheus with micrometer working and now you need to do the same thing without micrometer? Can you help me understand why the second app is excluding micrometer? Just trying to understand the usecase – checketts Jun 30 '22 at 12:54

0 Answers0