Browse Source

user-service 引入 spring-boot-starter-actuator 依赖, 为 Hystrix 监控提供数据

reghao 8 months ago
parent
commit
dc8fa234f7
2 changed files with 15 additions and 1 deletions
  1. 5 0
      user/user-service/pom.xml
  2. 10 1
      user/user-service/src/main/resources/application.yml

+ 5 - 0
user/user-service/pom.xml

@@ -94,6 +94,11 @@
             <version>2.2.10.RELEASE</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>org.springdoc</groupId>
             <artifactId>springdoc-openapi-ui</artifactId>

+ 10 - 1
user/user-service/src/main/resources/application.yml

@@ -43,4 +43,13 @@ eureka:
     prefer-ip-address: true
   client:
     register-with-eureka: true
-    fetch-registry: true
+    fetch-registry: true
+management:
+  endpoints:
+    web:
+#      base-path: /api/user/actuator
+      exposure:
+        include: "*"
+  metrics:
+    tags:
+      application: ${spring.application.name}