I want to publish all info that is already on /actuator/health to /actuator/prometheus, since the /actuator/prometheus endpoint doesn't contain metrics about the disk space or LDAP/database availability. I found that one can make a DiskSpaceMetricsConfiguration class (https://www.ivankrizsan.se/2021/01/23/spring-boot-prometheus-disk-space-metrics), and that works, but I can't figure out how to do the same for app status, db status, and ldap status.
I'm using spring-boot 2.1.9, spring-boot-starter-actuator 2.5.1, and micrometer-registry-prometheus 1.2.1.
CodePudding user response:
The versions you are using are not compatible with each other, please use the Spring Boot BOM, it will set the versions for you.
The Spring Boot documentation has a section about Mapping Health Indicators to Micrometer Metrics. You can do the same for each health indicator.
The trick here is converting a Health Indicator to a Gauge
, you can do this in multiple ways, it is up to you, you can use 0/1 values to indicate if the service is UP
or not or you can use different values for each status like the documentation above suggests.