I am evaluating and learning about options for monitoring metrics for Java applications with SpringBoot (2.6.6) and I have done some testing with Prometheus, but there are some differences between using the Prometheus Java agent and using from the micrometer-registry-prometheus dependency with actuator (actuator/prometheus).
Using the Java agent there are fairly much more fields than from actuator/prometheus (372 vs 110), but one of those records I am not able to visualize from actuator/prometheus is my custom MBean (i.e. com_training_testing_mbean_statistic_total).
For Java agent the version is jmx_prometheus_javaagent-0.19.0.jar and the config file only contains:
rules:
- pattern: ".*"
and for actuator/prometheus I am using these dependency versions
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.6.6</verion>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.8.4</verion>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-jmx</artifactId>
<version>1.8.4</verion>
</dependency>
and application.properties:
management.endpoints.web.exposure.include=prometheus
So my doubt is if there is a way to get MBeans from actuator/prometheus? (Maybe a configuration is needed)