Add a property to enable/disable metrics module (#8484)

This commit is contained in:
kezhenxu94 2022-02-24 10:21:47 +08:00 committed by GitHub
parent c1592ff38e
commit fa19006a18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 1 deletions

View File

@ -52,6 +52,9 @@ management:
alert:
port: 50052
metrics:
enabled: true
# Override by profile
---

View File

@ -104,6 +104,9 @@ registry:
audit:
enabled: false
metrics:
enabled: true
# Override by profile
---

View File

@ -121,6 +121,9 @@ management:
tags:
application: ${spring.application.name}
metrics:
enabled: true
# Override by profile
---

View File

@ -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) {

View File

@ -67,6 +67,9 @@ management:
tags:
application: ${spring.application.name}
metrics:
enabled: true
# Override by profile
---
spring:

View File

@ -180,6 +180,9 @@ management:
audit:
enabled: true
metrics:
enabled: true
# Override by profile
---
spring:

View File

@ -83,3 +83,6 @@ management:
metrics:
tags:
application: ${spring.application.name}
metrics:
enabled: true