- 后端:集成 Prometheus
This commit is contained in:
parent
17614d4265
commit
7905541501
|
@ -18,7 +18,7 @@ public class GlobalResponseBodyHandler implements ResponseBodyAdvice {
|
|||
if (returnType.getMethod() == null) {
|
||||
return false;
|
||||
}
|
||||
return returnType.getMethod().getReturnType().isAssignableFrom(CommonResult.class);
|
||||
return returnType.getMethod().getReturnType() == CommonResult.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
16
pom.xml
16
pom.xml
|
@ -58,6 +58,10 @@
|
|||
<servlet.version>2.5</servlet.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>-->
|
||||
|
||||
<java.version>1.8</java.version>
|
||||
|
@ -233,12 +237,24 @@
|
|||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
<version>${spring-boot-admin-starter-client.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-prometheus</artifactId>
|
||||
<version>${micrometer.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
<version>${sentinel.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.prometheus</groupId>
|
||||
<artifactId>simpleclient_spring_boot</artifactId>
|
||||
<version>${prometheus-spring-boot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Test 相关 -->
|
||||
|
||||
|
|
|
@ -65,6 +65,21 @@
|
|||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</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>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package cn.iocoder.mall.admin.application.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
//@EnablePrometheusEndpoint
|
||||
//@EnableSpringBootMetricsCollector
|
||||
public class MonitorConfiguration {
|
||||
}
|
|
@ -32,3 +32,11 @@ swagger:
|
|||
description: 管理员子系统
|
||||
version: 1.0.0
|
||||
base-package: cn.iocoder.mall.admin.application.controller
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info,env,metrics,prometheus
|
||||
metrics:
|
||||
enabled: true
|
||||
|
|
Loading…
Reference in New Issue