you need to check many things to be sure to enable Prometheus by Actuator
First thing you should put the following dependency on your pom.xml
to enable Prometheus on your project.
<!-- enable prometheus-->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.10.2</version>
</dependency>
The second point you must check if the actuator exists on your
project or not if doesn't exist, you need to add the following
dependency.
<!--to enable actuator help to trace project-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
You need to add the following scripts to your application.yml to
enable the actuator and Prometheus by actuator.
.
management:
security:
enabled: false
server:
port: 9000
endpoint:
metrics:
enabled: true
prometheus:
enabled: true
health:
show-details: always
show-components: always
probes:
enabled: true
shutdown:
enabled: true
info:
env:
enabled: true
enabled: true
endpoints:
web:
exposure:
include: prometheus, metrics, info, health, shutdown, beans
using the above script the actuator will run on port 9000 and you can send a request to the following URL to access the actuator.
http://localhost:9000/actuator/prometheus
and the following URL to access Prometheus
http://localhost:9000/actuator/prometheus
Note: you must check where you are writing your script because I was confused between endpoint and endpoints
- The endpoint to set the actuator config.
- The endpoints to set the actuator URLs endpoint
Note: you can delete the port from application.yml
and the actuator will run by current application port
best luck
--debug
flag (or-Ddebug
). From the given information, it seems like some autoconfiguration is not being done. Enabling debug will tell you exactly why (either missing dependency, wrongly configured properties, etc.). – Visceral