From fa19006a18e7fb79e60657e77232ae17c13a4c7d Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Thu, 24 Feb 2022 10:21:47 +0800 Subject: [PATCH] Add a property to enable/disable metrics module (#8484) --- .../src/main/resources/application.yaml | 3 +++ dolphinscheduler-api/src/main/resources/application.yaml | 3 +++ dolphinscheduler-master/src/main/resources/application.yaml | 3 +++ .../org/apache/dolphinscheduler/meter/MeterConfiguration.java | 3 ++- dolphinscheduler-python/src/main/resources/application.yaml | 3 +++ .../src/main/resources/application.yaml | 3 +++ dolphinscheduler-worker/src/main/resources/application.yaml | 3 +++ 7 files changed, 20 insertions(+), 1 deletion(-) diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/application.yaml b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/application.yaml index d2bb0cfac0..f68d1b8f41 100644 --- a/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/application.yaml +++ b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/application.yaml @@ -52,6 +52,9 @@ management: alert: port: 50052 +metrics: + enabled: true + # Override by profile --- diff --git a/dolphinscheduler-api/src/main/resources/application.yaml b/dolphinscheduler-api/src/main/resources/application.yaml index f53445a48b..72a6cd3a9a 100644 --- a/dolphinscheduler-api/src/main/resources/application.yaml +++ b/dolphinscheduler-api/src/main/resources/application.yaml @@ -104,6 +104,9 @@ registry: audit: enabled: false +metrics: + enabled: true + # Override by profile --- diff --git a/dolphinscheduler-master/src/main/resources/application.yaml b/dolphinscheduler-master/src/main/resources/application.yaml index 55e7ea6c25..beefc22771 100644 --- a/dolphinscheduler-master/src/main/resources/application.yaml +++ b/dolphinscheduler-master/src/main/resources/application.yaml @@ -121,6 +121,9 @@ management: tags: application: ${spring.application.name} +metrics: + enabled: true + # Override by profile --- diff --git a/dolphinscheduler-meter/src/main/java/org/apache/dolphinscheduler/meter/MeterConfiguration.java b/dolphinscheduler-meter/src/main/java/org/apache/dolphinscheduler/meter/MeterConfiguration.java index 7b517f37b7..d8b7297853 100644 --- a/dolphinscheduler-meter/src/main/java/org/apache/dolphinscheduler/meter/MeterConfiguration.java +++ b/dolphinscheduler-meter/src/main/java/org/apache/dolphinscheduler/meter/MeterConfiguration.java @@ -21,10 +21,10 @@ package org.apache.dolphinscheduler.meter; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.context.annotation.Profile; import io.micrometer.core.aop.CountedAspect; import io.micrometer.core.aop.TimedAspect; @@ -33,6 +33,7 @@ import io.micrometer.core.instrument.MeterRegistry; @Configuration @EnableAspectJAutoProxy @EnableAutoConfiguration +@ConditionalOnProperty(prefix = "metrics", name = "enabled", havingValue = "true") public class MeterConfiguration { @Bean public TimedAspect timedAspect(MeterRegistry registry) { diff --git a/dolphinscheduler-python/src/main/resources/application.yaml b/dolphinscheduler-python/src/main/resources/application.yaml index b5dc00cd89..8c60ac1f66 100644 --- a/dolphinscheduler-python/src/main/resources/application.yaml +++ b/dolphinscheduler-python/src/main/resources/application.yaml @@ -67,6 +67,9 @@ management: tags: application: ${spring.application.name} +metrics: + enabled: true + # Override by profile --- spring: diff --git a/dolphinscheduler-standalone-server/src/main/resources/application.yaml b/dolphinscheduler-standalone-server/src/main/resources/application.yaml index 53cfcbc9e2..afd3f5d4ff 100644 --- a/dolphinscheduler-standalone-server/src/main/resources/application.yaml +++ b/dolphinscheduler-standalone-server/src/main/resources/application.yaml @@ -180,6 +180,9 @@ management: audit: enabled: true +metrics: + enabled: true + # Override by profile --- spring: diff --git a/dolphinscheduler-worker/src/main/resources/application.yaml b/dolphinscheduler-worker/src/main/resources/application.yaml index 9d5d0ff67a..3f79a32863 100644 --- a/dolphinscheduler-worker/src/main/resources/application.yaml +++ b/dolphinscheduler-worker/src/main/resources/application.yaml @@ -83,3 +83,6 @@ management: metrics: tags: application: ${spring.application.name} + +metrics: + enabled: true