0
votes

I'm new to micrometer and Prometheus, I only used dropwizards metrics. It bothers me a bit, that I actually need to have 3 different instances up and running to see the metrics

  • The spring boot application itself with micrometer
  • Prometheus for metrics aggregation
  • And grafana for visualisation.

With dropwizard I could expose aggregated metrics right away.

That is, why I was curious about whether it would be possible to start Prometheus together with my spring boot application to expose nicely aggregated data right away. So far I couldn't find anything useful so I hope someone here might be able to help me.

1
Do you only have one Spring Boot Application? And what kind of metrics are you interested in? - Simon Martinelli
Yes, one application. I need the time aggregated values of a simple counter, like "number of failed requests in the last 5 minutes". - Mr Shorly
what do you mean by Prometheus together with my spring boot application ? both as single application ? - Niraj Sonawane
Yes both as one application in the best case. If that is not possible maybe it would be possible to configure the spring project in a way that at startup it also starts a prometheus instance? - Mr Shorly

1 Answers

2
votes

Welcome to Microservices. Prometheus is written in Go, so Java won't be able to start it, though you could use something like TestContainers (a Java library for starting Docker containers) to start up a Prometheus instance for you.

If you don't want Prometheus itself, you could startup a SimpleMeterRegistry, or a LoggingMeterRegistry that do some lightweight aggregations within your app (you may need to extend them to get exactly what you are looking for).

There is even a DropWizard based registry, but I haven't played with that one.