Commit 0831e481 authored by Michael's avatar Michael

short manual how to add jvm metrics

parent 330a2dd3
# Short manual to expose Java metrics with Spring Boot for Prometheus
> Scope is Spring Boot 1.4. Since Spring Boot 2.0 [Micrometer](https://github.com/micrometer-metrics/micrometer) is used Therefore, from version 2 small adjustements are needed
## Add actuators to the classpath with your POM.xml
```xml
<-- Actuator exposing prometheus friedly metrics -->
<dependency>
<groupId>com.moelholm</groupId>
<artifactId>prometheus-spring-boot-starter</artifactId>
<version>1.0.2</version>
</dependency>
<-- For convinience activate a list of all actuators -->
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
</dependency>
```
## Activate actuators with environment variables
In your docker-compose.yml
```yml
environment:
- ENDPOINTS_ENABLED=true
- ENDPOINTS_SENSITIVE=true
# optional for being Spring Boot 2 compatible
# as the actuators are per default under /actuators there
- MANAGEMENT_CONTEXT-PATH=/actuator
```
## Check Results
- /actuators **lists all actuators**
- /actuators/prometheus **lists metrics ready for prometheus**
## Ressources
[prometheus-spring-boot-starter at Github](https://github.com/moelholm/prometheus-spring-boot-starter) and [prometheus-spring-boot-starter Blog](https://moelholm.com/2017/02/06/spring-boot-prometheus-actuator-endpoint/)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment