提交 79055415 authored 作者: YunaiV's avatar YunaiV

- 后端:集成 Prometheus

上级 17614d42
...@@ -18,7 +18,7 @@ public class GlobalResponseBodyHandler implements ResponseBodyAdvice { ...@@ -18,7 +18,7 @@ public class GlobalResponseBodyHandler implements ResponseBodyAdvice {
if (returnType.getMethod() == null) { if (returnType.getMethod() == null) {
return false; return false;
} }
return returnType.getMethod().getReturnType().isAssignableFrom(CommonResult.class); return returnType.getMethod().getReturnType() == CommonResult.class;
} }
@Override @Override
......
...@@ -58,6 +58,10 @@ ...@@ -58,6 +58,10 @@
<servlet.version>2.5</servlet.version> <servlet.version>2.5</servlet.version>
<seata.version>0.5.1</seata.version> <seata.version>0.5.1</seata.version>
<prometheus-spring-boot.version>0.6.0</prometheus-spring-boot.version>
<micrometer.version>1.1.4</micrometer.version>
<!-- <seata.version>0.6.0-SNAPSHOT</seata.version>--> <!-- <seata.version>0.6.0-SNAPSHOT</seata.version>-->
<java.version>1.8</java.version> <java.version>1.8</java.version>
...@@ -233,12 +237,24 @@ ...@@ -233,12 +237,24 @@
<artifactId>spring-boot-admin-starter-client</artifactId> <artifactId>spring-boot-admin-starter-client</artifactId>
<version>${spring-boot-admin-starter-client.version}</version> <version>${spring-boot-admin-starter-client.version}</version>
</dependency> </dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>${micrometer.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
<version>${sentinel.version}</version> <version>${sentinel.version}</version>
</dependency> </dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_spring_boot</artifactId>
<version>${prometheus-spring-boot.version}</version>
</dependency>
<!-- Test 相关 --> <!-- Test 相关 -->
......
...@@ -65,6 +65,21 @@ ...@@ -65,6 +65,21 @@
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>io.prometheus</groupId>-->
<!-- <artifactId>simpleclient_spring_boot</artifactId>-->
<!-- </dependency>-->
<!-- 测试相关 --> <!-- 测试相关 -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
......
package cn.iocoder.mall.admin.application.config;
import org.springframework.context.annotation.Configuration;
@Configuration
//@EnablePrometheusEndpoint
//@EnableSpringBootMetricsCollector
public class MonitorConfiguration {
}
...@@ -32,3 +32,11 @@ swagger: ...@@ -32,3 +32,11 @@ swagger:
description: 管理员子系统 description: 管理员子系统
version: 1.0.0 version: 1.0.0
base-package: cn.iocoder.mall.admin.application.controller base-package: cn.iocoder.mall.admin.application.controller
management:
endpoints:
web:
exposure:
include: health,info,env,metrics,prometheus
metrics:
enabled: true
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论