I am trying to add prometheus into my spring boot project. I am using spring boot actuator to expose the metrics endpoint . Did everything following tutorials but I keep on getting a 404 error. I also tried every single solution given in:
Unable to access Spring Boot Actuator "/actuator" endpoint
and
Spring Boot 2 - Actuator Metrics Endpoint not working
My dependecies:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.7.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-explorer</artifactId>
<version>3.5.1</version>
</dependency>
context.xml (external properties):
<Parameter name="management.endpoints.web.exposure.include" value="*"/>
<Parameter name="management.security.enabled" value="false"/>
<Parameter name="management.endpoints.beans.enabled" value="false"/>
<Parameter name="endpoints.actuator.enabled" value="true"/>
<Parameter name="management.endpoints.web.base-path" value="/actuator"/>
context.xml
, I assume you’re deploying a war file to Tomcat. What does yourSpringBootServletInitializer
subclass look like? What does Tomcat log when you start it? – Andy WilkinsonSpringBootServletInitializer
deploying your app will, essentially, do nothing. See docs.spring.io/spring-boot/docs/2.2.x/reference/htmlsingle/… for what you need to do. – Andy Wilkinson