Spring Boot 2 - drive metrics endpoint not working

In my Spring Boot App (2.0.0.M7) application.properties I installed

management.endpoint.metrics.enabled=true

However, when I clicked

localhost:8080/actuator/metrics 

I get 404.

What's the solution?

+18
source share
9 answers

I would like to supplement OP's answer with more detailed information, since I worked a bit before finally stumbled upon this solution, and there seems to be a lot of confusion regarding changes in the behavior of the drive with Spring Boot 2.

What has not changed

You must enable dependency for the spring boot drive

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
</dependencies>

If you want to access the drive endpoints via HTTP, you also need to add a dependency to spring-boot-starter-web

, ,

    <dependencies>
    <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>
</dependencies>

, Spring Boot 2

  1. , /health, /metrics .., . http://{host}:{port}/actuator. , , - , , /hello - actator /actuator /hello/actuator.

  2. /actuator /actuator HATEOAS. Spring Boot 2 , HATEOAS application.yml

  3. HTTP, .

    :

    • /health /info, , Spring Security .

    • , /shutdown ( /health /info)

  4. ( ), , management.endpoints.web.exposure.include=* application.properties. , yml-.

  5. , endpoints.xyz, , management.xyz

. ,

+49

( YAML), 2:

management:
  endpoints:
    web:
      exposure:
        include: info, health, metrics
  metrics:
    export:
      atlas:
        enabled: false

here

+7

application.properties:

management.endpoints.web.exposure.include=metrics

.

+7

application.properties. , .

management.endpoints.beans.enabled=false
management.endpoints.web.exposure.include=*
+4

"*" YAML, , ( ) , :

management:
  endpoints:
    web:
      exposure:
        include: "*"
+3
+2

.Spring Boot 2.0.x Spring Boot.
, Spring Boot 2s, , , . , :

management.endpoints.web.exposure.include:

/actuator/metrics .

, - : http://localhost: 8080/activator/metrics/jvm.memory.used

+1

Spring Boot 1.5.15 2.1.4

Spring Boot pom.xml :

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-actuator</artifactId>
</dependency>

:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

starter artifactId.

+1

server.servlet.context- =/ management.endpoints.web.exposure.include = *

:http://localhost:8080/travel/actuator/metrics/

0

Source: https://habr.com/ru/post/1693904/


All Articles