diff --git a/yudao-framework/yudao-spring-boot-starter-monitor/pom.xml b/yudao-framework/yudao-spring-boot-starter-monitor/pom.xml index a6d9ac8e4..bc8d235be 100644 --- a/yudao-framework/yudao-spring-boot-starter-monitor/pom.xml +++ b/yudao-framework/yudao-spring-boot-starter-monitor/pom.xml @@ -58,6 +58,12 @@ apm-toolkit-opentracing + + + io.micrometer + micrometer-registry-prometheus + + de.codecentric spring-boot-admin-starter-client diff --git a/归档/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/metrics/MetricsAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/config/YudaoMetricsAutoConfiguration.java similarity index 59% rename from 归档/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/metrics/MetricsAutoConfiguration.java rename to yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/config/YudaoMetricsAutoConfiguration.java index b5fe3f029..cda0d2cb8 100644 --- a/归档/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/metrics/MetricsAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/config/YudaoMetricsAutoConfiguration.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.spring.boot.metrics; +package cn.iocoder.yudao.framework.tracer.config; import io.micrometer.core.instrument.MeterRegistry; import org.springframework.beans.factory.annotation.Value; @@ -8,16 +8,19 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +/** + * Metrics 配置类 + * + * @author 芋道源码 + */ @Configuration @ConditionalOnClass({MeterRegistryCustomizer.class}) -@ConditionalOnProperty(prefix = "management.metrics", value = "enable", matchIfMissing = true) // 允许使用 management.metrics.enable=false 禁用 Metrics -public class MetricsAutoConfiguration { - - @Value("${spring.application.name}") - private String applicationName; +@ConditionalOnProperty(prefix = "yudao.metrics", value = "enable", matchIfMissing = true) // 允许使用 yudao.metrics.enable=false 禁用 Metrics +public class YudaoMetricsAutoConfiguration { @Bean - MeterRegistryCustomizer metricsCommonTags() { + public MeterRegistryCustomizer metricsCommonTags( + @Value("${spring.application.name}") String applicationName) { return registry -> registry.config().commonTags("application", applicationName); } diff --git a/yudao-framework/yudao-spring-boot-starter-monitor/src/main/resources/META-INF/spring.factories b/yudao-framework/yudao-spring-boot-starter-monitor/src/main/resources/META-INF/spring.factories index 6f4f606bb..9b69f01ea 100644 --- a/yudao-framework/yudao-spring-boot-starter-monitor/src/main/resources/META-INF/spring.factories +++ b/yudao-framework/yudao-spring-boot-starter-monitor/src/main/resources/META-INF/spring.factories @@ -1,2 +1,3 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ - cn.iocoder.yudao.framework.tracer.config.YudaoTracerAutoConfiguration + cn.iocoder.yudao.framework.tracer.config.YudaoTracerAutoConfiguration,\ + cn.iocoder.yudao.framework.tracer.config.YudaoMetricsAutoConfiguration diff --git a/归档/common/mall-spring-boot/pom.xml b/归档/common/mall-spring-boot/pom.xml deleted file mode 100644 index 8d36246d0..000000000 --- a/归档/common/mall-spring-boot/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - common - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - mall-spring-boot - - - - - cn.iocoder.mall - common-framework - 1.0-SNAPSHOT - - - - - org.springframework.boot - spring-boot-starter - - - - - org.springframework - spring-webmvc - true - - - javax.servlet - servlet-api - true - - - - - org.springframework.boot - spring-boot-actuator-autoconfigure - true - - - - io.micrometer - micrometer-registry-prometheus - true - - - - - diff --git a/归档/common/mall-spring-boot/src/main/resources/META-INF/spring.factories b/归档/common/mall-spring-boot/src/main/resources/META-INF/spring.factories deleted file mode 100644 index c2211a8c9..000000000 --- a/归档/common/mall-spring-boot/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ - cn.iocoder.mall.spring.boot.metrics.MetricsAutoConfiguration