From d31872b5747349cbbbb472b5873eb6b26c68fad7 Mon Sep 17 00:00:00 2001 From: yanhom Date: Tue, 12 Nov 2024 23:29:21 +0800 Subject: [PATCH] [ISSUE #504] change config prefix from 'spring.dynamic.tp' to 'dynamictp' --- .../adapter/common/AbstractDtpAdapter.java | 2 +- .../adapter/common/DtpAdapterListener.java | 9 +- .../common/constant/DynamicTpConst.java | 2 +- .../dynamictp/common/event/DtpEvent.java | 2 +- .../src/main/resources/application.yml | 43 +- .../src/main/resources/application.yml | 45 ++- .../src/main/resources/application.yml | 57 ++- .../src/main/resources/application.yml | 57 ++- .../src/main/resources/application.yml | 57 ++- .../src/main/resources/application.yml | 51 ++- .../src/main/resources/application.yml | 43 +- .../src/main/resources/application.yml | 43 +- .../src/main/resources/application.yml | 21 +- .../src/main/resources/application.yml | 43 +- .../src/main/resources/application.yml | 59 ++- .../src/main/resources/application.yml | 27 +- .../src/main/resources/application.yml | 47 ++- .../src/main/resources/application.yml | 73 ++-- .../resources/dynamic-tp-apollo-demo-dtp.yml | 164 ++++---- .../dynamic-tp-cloud-consul-demo-dtp.yml | 164 ++++---- .../src/main/resources/application.yml | 14 +- .../dynamic-tp-huawei-cloud-demo-dtp-dev.yml | 164 ++++---- .../dynamic-tp-nacos-cloud-demo-dtp-dev.yml | 184 +++++---- .../dynamic-tp-nacos-demo-dtp-dev.yml | 164 ++++---- .../dynamic-tp-polaris-cloud-demo-dtp-dev.yml | 164 ++++---- .../src/main/resources/config.txt | 132 +++---- .../src/main/resources/application.yml | 16 +- .../src/main/resources/config.txt | 102 ++--- .../dynamic-tp-zookeeper-demo.properties | 102 ++--- ...itional-spring-configuration-metadata.json | 168 ++++---- .../apollo/ApolloInitListener.java | 5 +- .../apollo/ApolloRefresherTest.java | 5 +- .../cloud/CloudRefresherTest.java | 8 +- .../nacos/NacosRefresherTest.java | 7 +- .../resources/dynamic-tp-demo-dtp-dev.yml | 130 +++--- .../test/core/parse/JsonConfigParserTest.java | 2 +- .../parse/PropertiesConfigParserTest.java | 2 +- .../test/core/parse/YamlConfigParserTest.java | 2 +- .../core/refresher/AbstractRefresherTest.java | 9 +- .../spring/DtpBaseBeanConfigurationTest.java | 10 +- .../spring/DtpLifecycleSpringAdapterTest.java | 4 +- .../core/spring/PropertiesBinderTest.java | 22 +- .../test/resources/demo-dtp-dev.properties | 144 +++---- .../src/test/resources/demo-dtp-dev.yml | 236 ++++++----- .../src/test/resources/dynamic-tp-demo.yml | 178 +++++---- .../dynamic-tp-nacos-demo-dtp-dev.yml | 374 +++++++++--------- .../test/resources/postprocessor-dtp-dev.yml | 52 +-- 47 files changed, 1688 insertions(+), 1721 deletions(-) diff --git a/adapter/adapter-common/src/main/java/org/dromara/dynamictp/adapter/common/AbstractDtpAdapter.java b/adapter/adapter-common/src/main/java/org/dromara/dynamictp/adapter/common/AbstractDtpAdapter.java index 561e9c1f0..604d0676b 100644 --- a/adapter/adapter-common/src/main/java/org/dromara/dynamictp/adapter/common/AbstractDtpAdapter.java +++ b/adapter/adapter-common/src/main/java/org/dromara/dynamictp/adapter/common/AbstractDtpAdapter.java @@ -74,7 +74,7 @@ public abstract class AbstractDtpAdapter implements DtpAdapter { protected final Map executors = Maps.newHashMap(); - public AbstractDtpAdapter() { + protected AbstractDtpAdapter() { EventBusManager.register(this); } diff --git a/adapter/adapter-common/src/main/java/org/dromara/dynamictp/adapter/common/DtpAdapterListener.java b/adapter/adapter-common/src/main/java/org/dromara/dynamictp/adapter/common/DtpAdapterListener.java index 107e5b7d8..c061c714e 100644 --- a/adapter/adapter-common/src/main/java/org/dromara/dynamictp/adapter/common/DtpAdapterListener.java +++ b/adapter/adapter-common/src/main/java/org/dromara/dynamictp/adapter/common/DtpAdapterListener.java @@ -18,6 +18,9 @@ package org.dromara.dynamictp.adapter.common; import com.google.common.eventbus.Subscribe; +import lombok.extern.slf4j.Slf4j; +import lombok.val; +import org.apache.commons.collections4.MapUtils; import org.dromara.dynamictp.common.event.AlarmCheckEvent; import org.dromara.dynamictp.common.event.CollectEvent; import org.dromara.dynamictp.common.event.RefreshEvent; @@ -26,9 +29,7 @@ import org.dromara.dynamictp.common.properties.DtpProperties; import org.dromara.dynamictp.core.handler.CollectorHandler; import org.dromara.dynamictp.core.notifier.manager.AlarmManager; -import lombok.extern.slf4j.Slf4j; -import lombok.val; -import org.apache.commons.collections4.MapUtils; + import java.util.EventObject; import static org.dromara.dynamictp.common.constant.DynamicTpConst.SCHEDULE_NOTIFY_ITEMS; @@ -47,7 +48,7 @@ public DtpAdapterListener() { } @Subscribe - public void handleRefreshedEvent(EventObject event) { + public void handleDtpEvent(EventObject event) { try { if (event instanceof RefreshEvent) { RefreshEvent refreshEvent = (RefreshEvent) event; diff --git a/common/src/main/java/org/dromara/dynamictp/common/constant/DynamicTpConst.java b/common/src/main/java/org/dromara/dynamictp/common/constant/DynamicTpConst.java index 8fec985fd..1ea2c48b4 100644 --- a/common/src/main/java/org/dromara/dynamictp/common/constant/DynamicTpConst.java +++ b/common/src/main/java/org/dromara/dynamictp/common/constant/DynamicTpConst.java @@ -32,7 +32,7 @@ public final class DynamicTpConst { private DynamicTpConst() { } - public static final String MAIN_PROPERTIES_PREFIX = "spring.dynamic.tp"; + public static final String MAIN_PROPERTIES_PREFIX = "dynamictp"; public static final String DTP_ENABLED_PROP = MAIN_PROPERTIES_PREFIX + ".enabled"; diff --git a/common/src/main/java/org/dromara/dynamictp/common/event/DtpEvent.java b/common/src/main/java/org/dromara/dynamictp/common/event/DtpEvent.java index 452e0502e..7d2198348 100644 --- a/common/src/main/java/org/dromara/dynamictp/common/event/DtpEvent.java +++ b/common/src/main/java/org/dromara/dynamictp/common/event/DtpEvent.java @@ -33,7 +33,7 @@ public abstract class DtpEvent extends EventObject { private final transient DtpProperties dtpProperties; - public DtpEvent(Object source, DtpProperties dtpProperties) { + protected DtpEvent(Object source, DtpProperties dtpProperties) { super(source); this.dtpProperties = dtpProperties; } diff --git a/example/example-adapter/example-adapter-brpc/src/main/resources/application.yml b/example/example-adapter/example-adapter-brpc/src/main/resources/application.yml index 3e3c4a1b6..b5137e7cf 100644 --- a/example/example-adapter/example-adapter-brpc/src/main/resources/application.yml +++ b/example/example-adapter/example-adapter-brpc/src/main/resources/application.yml @@ -7,28 +7,27 @@ spring: profiles: active: dev - dynamic: - tp: - enabled: true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: micrometer # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - monitorInterval: 5 - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - brpcTp: # brpc 线程池配置 - - threadPoolName: rpc#server # 名称规则:biz_thread_pool_name + "#" + client/server - corePoolSize: 100 - maximumPoolSize: 200 - keepAliveTime: 60 +dynamictp: + enabled: true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: micrometer # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + monitorInterval: 5 + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + brpcTp: # brpc 线程池配置 + - threadPoolName: rpc#server # 名称规则:biz_thread_pool_name + "#" + client/server + corePoolSize: 100 + maximumPoolSize: 200 + keepAliveTime: 60 starlight: server: diff --git a/example/example-adapter/example-adapter-dubbo/example-adapter-alibaba-dubbo/src/main/resources/application.yml b/example/example-adapter/example-adapter-dubbo/example-adapter-alibaba-dubbo/src/main/resources/application.yml index 9c39fb9db..60070116a 100644 --- a/example/example-adapter/example-adapter-dubbo/example-adapter-alibaba-dubbo/src/main/resources/application.yml +++ b/example/example-adapter/example-adapter-dubbo/example-adapter-alibaba-dubbo/src/main/resources/application.yml @@ -7,29 +7,28 @@ spring: profiles: active: dev - dynamic: - tp: - enabled: true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - monitorInterval: 5 - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - dubboTp: # dubbo 线程池配置 - - threadPoolName: dubboTp#20880 # 名称规则:dubboTp + "#" + 协议端口 - threadPoolAliasName: 测试线程池 - corePoolSize: 100 - maximumPoolSize: 200 - keepAliveTime: 60 +dynamictp: + enabled: true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + monitorInterval: 5 + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + dubboTp: # dubbo 线程池配置 + - threadPoolName: dubboTp#20880 # 名称规则:dubboTp + "#" + 协议端口 + threadPoolAliasName: 测试线程池 + corePoolSize: 100 + maximumPoolSize: 200 + keepAliveTime: 60 dubbo: application: diff --git a/example/example-adapter/example-adapter-dubbo/example-adapter-apache-dubbo/example-adapter-apache-dubbo-2.7.3/src/main/resources/application.yml b/example/example-adapter/example-adapter-dubbo/example-adapter-apache-dubbo/example-adapter-apache-dubbo-2.7.3/src/main/resources/application.yml index 7cb1f62e8..ad48d6b2f 100644 --- a/example/example-adapter/example-adapter-dubbo/example-adapter-apache-dubbo/example-adapter-apache-dubbo-2.7.3/src/main/resources/application.yml +++ b/example/example-adapter/example-adapter-dubbo/example-adapter-apache-dubbo/example-adapter-apache-dubbo-2.7.3/src/main/resources/application.yml @@ -7,35 +7,34 @@ spring: profiles: active: dev - dynamic: - tp: - enabled: true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - monitorInterval: 5 - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - dubboTp: # dubbo 线程池配置 - - threadPoolName: dubboTp#20880 # 名称规则:dubboTp + "#" + 协议端口 - threadPoolAliasName: 测试线程池 - corePoolSize: 100 - maximumPoolSize: 200 - keepAliveTime: 60 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警) - - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 80 # 报警阈值 - platforms: [ ding,wechat ] # 可选配置,不配置默认拿上层platforms配置的所以平台 - interval: 120 # 报警间隔(单位:s) +dynamictp: + enabled: true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + monitorInterval: 5 + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + dubboTp: # dubbo 线程池配置 + - threadPoolName: dubboTp#20880 # 名称规则:dubboTp + "#" + 协议端口 + threadPoolAliasName: 测试线程池 + corePoolSize: 100 + maximumPoolSize: 200 + keepAliveTime: 60 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警) + - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 + enabled: true + threshold: 80 # 报警阈值 + platforms: [ ding,wechat ] # 可选配置,不配置默认拿上层platforms配置的所以平台 + interval: 120 # 报警间隔(单位:s) dubbo: application: diff --git a/example/example-adapter/example-adapter-dubbo/example-adapter-apache-dubbo/example-adapter-apache-dubbo-2.7.9/src/main/resources/application.yml b/example/example-adapter/example-adapter-dubbo/example-adapter-apache-dubbo/example-adapter-apache-dubbo-2.7.9/src/main/resources/application.yml index 7cb1f62e8..ad48d6b2f 100644 --- a/example/example-adapter/example-adapter-dubbo/example-adapter-apache-dubbo/example-adapter-apache-dubbo-2.7.9/src/main/resources/application.yml +++ b/example/example-adapter/example-adapter-dubbo/example-adapter-apache-dubbo/example-adapter-apache-dubbo-2.7.9/src/main/resources/application.yml @@ -7,35 +7,34 @@ spring: profiles: active: dev - dynamic: - tp: - enabled: true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - monitorInterval: 5 - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - dubboTp: # dubbo 线程池配置 - - threadPoolName: dubboTp#20880 # 名称规则:dubboTp + "#" + 协议端口 - threadPoolAliasName: 测试线程池 - corePoolSize: 100 - maximumPoolSize: 200 - keepAliveTime: 60 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警) - - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 80 # 报警阈值 - platforms: [ ding,wechat ] # 可选配置,不配置默认拿上层platforms配置的所以平台 - interval: 120 # 报警间隔(单位:s) +dynamictp: + enabled: true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + monitorInterval: 5 + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + dubboTp: # dubbo 线程池配置 + - threadPoolName: dubboTp#20880 # 名称规则:dubboTp + "#" + 协议端口 + threadPoolAliasName: 测试线程池 + corePoolSize: 100 + maximumPoolSize: 200 + keepAliveTime: 60 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警) + - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 + enabled: true + threshold: 80 # 报警阈值 + platforms: [ ding,wechat ] # 可选配置,不配置默认拿上层platforms配置的所以平台 + interval: 120 # 报警间隔(单位:s) dubbo: application: diff --git a/example/example-adapter/example-adapter-dubbo/example-adapter-apache-dubbo/example-adapter-apache-dubbo-3.0.7/src/main/resources/application.yml b/example/example-adapter/example-adapter-dubbo/example-adapter-apache-dubbo/example-adapter-apache-dubbo-3.0.7/src/main/resources/application.yml index 7cb1f62e8..ad48d6b2f 100644 --- a/example/example-adapter/example-adapter-dubbo/example-adapter-apache-dubbo/example-adapter-apache-dubbo-3.0.7/src/main/resources/application.yml +++ b/example/example-adapter/example-adapter-dubbo/example-adapter-apache-dubbo/example-adapter-apache-dubbo-3.0.7/src/main/resources/application.yml @@ -7,35 +7,34 @@ spring: profiles: active: dev - dynamic: - tp: - enabled: true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - monitorInterval: 5 - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - dubboTp: # dubbo 线程池配置 - - threadPoolName: dubboTp#20880 # 名称规则:dubboTp + "#" + 协议端口 - threadPoolAliasName: 测试线程池 - corePoolSize: 100 - maximumPoolSize: 200 - keepAliveTime: 60 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警) - - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 80 # 报警阈值 - platforms: [ ding,wechat ] # 可选配置,不配置默认拿上层platforms配置的所以平台 - interval: 120 # 报警间隔(单位:s) +dynamictp: + enabled: true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + monitorInterval: 5 + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + dubboTp: # dubbo 线程池配置 + - threadPoolName: dubboTp#20880 # 名称规则:dubboTp + "#" + 协议端口 + threadPoolAliasName: 测试线程池 + corePoolSize: 100 + maximumPoolSize: 200 + keepAliveTime: 60 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警) + - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 + enabled: true + threshold: 80 # 报警阈值 + platforms: [ ding,wechat ] # 可选配置,不配置默认拿上层platforms配置的所以平台 + interval: 120 # 报警间隔(单位:s) dubbo: application: diff --git a/example/example-adapter/example-adapter-dubbo/example-adapter-apache-dubbo/example-adapter-apache-dubbo-3.2.10/src/main/resources/application.yml b/example/example-adapter/example-adapter-dubbo/example-adapter-apache-dubbo/example-adapter-apache-dubbo-3.2.10/src/main/resources/application.yml index 7d1cfecb3..32fb83480 100644 --- a/example/example-adapter/example-adapter-dubbo/example-adapter-apache-dubbo/example-adapter-apache-dubbo-3.2.10/src/main/resources/application.yml +++ b/example/example-adapter/example-adapter-dubbo/example-adapter-apache-dubbo/example-adapter-apache-dubbo-3.2.10/src/main/resources/application.yml @@ -5,32 +5,31 @@ spring: application: name: dynamic-tp-adapter-dubbo-demo - dynamic: - tp: - enabled: true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - monitorInterval: 5 - platforms: # 通知报警平台配置 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - dubboTp: # dubbo 线程池配置 - - threadPoolName: dubboTp#20880 # 名称规则:dubboTp + "#" + 协议端口 - threadPoolAliasName: 测试线程池 - corePoolSize: 100 - maximumPoolSize: 200 - keepAliveTime: 60 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警) - - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 80 # 报警阈值 - platforms: [ ding ] # 可选配置,不配置默认拿上层platforms配置的所以平台 - interval: 120 # 报警间隔(单位:s) +dynamictp: + enabled: true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + monitorInterval: 5 + platforms: # 通知报警平台配置 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + dubboTp: # dubbo 线程池配置 + - threadPoolName: dubboTp#20880 # 名称规则:dubboTp + "#" + 协议端口 + threadPoolAliasName: 测试线程池 + corePoolSize: 100 + maximumPoolSize: 200 + keepAliveTime: 60 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警) + - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 + enabled: true + threshold: 80 # 报警阈值 + platforms: [ ding ] # 可选配置,不配置默认拿上层platforms配置的所以平台 + interval: 120 # 报警间隔(单位:s) dubbo: application: diff --git a/example/example-adapter/example-adapter-grpc/src/main/resources/application.yml b/example/example-adapter/example-adapter-grpc/src/main/resources/application.yml index d458aef50..109216733 100644 --- a/example/example-adapter/example-adapter-grpc/src/main/resources/application.yml +++ b/example/example-adapter/example-adapter-grpc/src/main/resources/application.yml @@ -19,28 +19,27 @@ spring: refresh: true # 必须配置,负责自动刷新不生效 refresh-enabled: true - dynamic: - tp: - enabled: true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - monitorInterval: 5 - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - grpcTp: # grpc 线程池配置 - - threadPoolName: grpcTp#9999 - corePoolSize: 100 - maximumPoolSize: 200 - keepAliveTime: 60 +dynamictp: + enabled: true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + monitorInterval: 5 + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + grpcTp: # grpc 线程池配置 + - threadPoolName: grpcTp#9999 + corePoolSize: 100 + maximumPoolSize: 200 + keepAliveTime: 60 grpc: server: diff --git a/example/example-adapter/example-adapter-hystrix/src/main/resources/application.yml b/example/example-adapter/example-adapter-hystrix/src/main/resources/application.yml index e314fb2db..91937e3b3 100644 --- a/example/example-adapter/example-adapter-hystrix/src/main/resources/application.yml +++ b/example/example-adapter/example-adapter-hystrix/src/main/resources/application.yml @@ -7,28 +7,27 @@ spring: profiles: active: dev - dynamic: - tp: - enabled: true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - monitorInterval: 5 - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - hystrixTp: # hystrix 线程池配置 - - threadPoolName: testThreadPoolKey - corePoolSize: 100 - maximumPoolSize: 200 - keepAliveTime: 60 +dynamictp: + enabled: true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + monitorInterval: 5 + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + hystrixTp: # hystrix 线程池配置 + - threadPoolName: testThreadPoolKey + corePoolSize: 100 + maximumPoolSize: 200 + keepAliveTime: 60 # 开启 SpringBoot Actuator Endpoint 暴露出DynamicTp指标接口 # 开启 prometheus 指标采集端点 diff --git a/example/example-adapter/example-adapter-liteflow/src/main/resources/application.yml b/example/example-adapter/example-adapter-liteflow/src/main/resources/application.yml index f61293d25..a20b74c48 100644 --- a/example/example-adapter/example-adapter-liteflow/src/main/resources/application.yml +++ b/example/example-adapter/example-adapter-liteflow/src/main/resources/application.yml @@ -10,17 +10,16 @@ spring: profiles: active: dev - dynamic: - tp: - enabled: true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - monitorInterval: 5 - liteflowTp: - - threadPoolName: liteflowTp#LiteFlowDefaultWhenExecutorBuilder - corePoolSize: 10 - maximumPoolSize: 20 - keepAliveTime: 60 +dynamictp: + enabled: true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + monitorInterval: 5 + liteflowTp: + - threadPoolName: liteflowTp#LiteFlowDefaultWhenExecutorBuilder + corePoolSize: 10 + maximumPoolSize: 20 + keepAliveTime: 60 # 开启 SpringBoot Actuator Endpoint 暴露出DynamicTp指标接口 # 开启 prometheus 指标采集端点 diff --git a/example/example-adapter/example-adapter-motan/src/main/resources/application.yml b/example/example-adapter/example-adapter-motan/src/main/resources/application.yml index daed76a01..c19c4f548 100644 --- a/example/example-adapter/example-adapter-motan/src/main/resources/application.yml +++ b/example/example-adapter/example-adapter-motan/src/main/resources/application.yml @@ -7,28 +7,27 @@ spring: profiles: active: dev - dynamic: - tp: - enabled: true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - monitorInterval: 5 - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - motanTp: # motan server 线程池配置 - - threadPoolName: motanTp#8002 - corePoolSize: 100 - maximumPoolSize: 200 - keepAliveTime: 60 +dynamictp: + enabled: true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + monitorInterval: 5 + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + motanTp: # motan server 线程池配置 + - threadPoolName: motanTp#8002 + corePoolSize: 100 + maximumPoolSize: 200 + keepAliveTime: 60 # 开启 SpringBoot Actuator Endpoint 暴露出DynamicTp指标接口 # 开启 prometheus 指标采集端点 diff --git a/example/example-adapter/example-adapter-okhttp3/src/main/resources/application.yml b/example/example-adapter/example-adapter-okhttp3/src/main/resources/application.yml index 6c7bfdd8f..0c0cc60f0 100644 --- a/example/example-adapter/example-adapter-okhttp3/src/main/resources/application.yml +++ b/example/example-adapter/example-adapter-okhttp3/src/main/resources/application.yml @@ -7,36 +7,35 @@ spring: profiles: active: dev - dynamic: - tp: - enabled: true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - monitorInterval: 5 - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 32d7bf40-1353 # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - okhttp3Tp: # okhttp3 线程池配置 - - threadPoolName: okHttpClientTp - corePoolSize: 1 - maximumPoolSize: 1 - keepAliveTime: 60 - runTimeout: 20 - queueTimeout: 10 - tomcatTp: # tomcat webserver 线程池配置 - corePoolSize: 1 - maximumPoolSize: 1 - keepAliveTime: 60 - runTimeout: 20 - queueTimeout: 10 +dynamictp: + enabled: true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + monitorInterval: 5 + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 32d7bf40-1353 # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + okhttp3Tp: # okhttp3 线程池配置 + - threadPoolName: okHttpClientTp + corePoolSize: 1 + maximumPoolSize: 1 + keepAliveTime: 60 + runTimeout: 20 + queueTimeout: 10 + tomcatTp: # tomcat webserver 线程池配置 + corePoolSize: 1 + maximumPoolSize: 1 + keepAliveTime: 60 + runTimeout: 20 + queueTimeout: 10 # 开启 SpringBoot Actuator Endpoint 暴露出DynamicTp指标接口 # 开启 prometheus 指标采集端点 diff --git a/example/example-adapter/example-adapter-rabbitmq/src/main/resources/application.yml b/example/example-adapter/example-adapter-rabbitmq/src/main/resources/application.yml index 97df5f97e..a48b8276c 100644 --- a/example/example-adapter/example-adapter-rabbitmq/src/main/resources/application.yml +++ b/example/example-adapter/example-adapter-rabbitmq/src/main/resources/application.yml @@ -15,20 +15,19 @@ spring: #password: rabbit #addresses: 111111 - dynamic: - tp: - enabled: true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: internal_logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - monitorInterval: 5 - rabbitmqTp: # rabbitmq 线程池配置 配置自行修改 - - threadPoolName: rabbitConnectionFactoryTp - threadPoolAliasName: rabbit线程池 - threadNamePrefix: rabbitExecutor - corePoolSize: 8 - maximumPoolSize: 16 - #单位秒 - keepAliveTime: 60 +dynamictp: + enabled: true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: internal_logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + monitorInterval: 5 + rabbitmqTp: # rabbitmq 线程池配置 配置自行修改 + - threadPoolName: rabbitConnectionFactoryTp + threadPoolAliasName: rabbit线程池 + threadNamePrefix: rabbitExecutor + corePoolSize: 8 + maximumPoolSize: 16 + #单位秒 + keepAliveTime: 60 # 开启 SpringBoot Actuator Endpoint 暴露出DynamicTp指标接口 # 开启 prometheus 指标采集端点 diff --git a/example/example-adapter/example-adapter-rocketmq/src/main/resources/application.yml b/example/example-adapter/example-adapter-rocketmq/src/main/resources/application.yml index 8c37229c8..f951349b9 100644 --- a/example/example-adapter/example-adapter-rocketmq/src/main/resources/application.yml +++ b/example/example-adapter/example-adapter-rocketmq/src/main/resources/application.yml @@ -7,30 +7,29 @@ spring: profiles: active: dev - dynamic: - tp: - enabled: true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - monitorInterval: 5 - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - - platform: email - receivers: 123456@qq.com,789789@qq.com # 收件人 - rocketMqTp: # rocketmq 线程池配置 - - threadPoolName: group#topic # 名称规则:group + "#" + topic - corePoolSize: 200 - maximumPoolSize: 200 - keepAliveTime: 60 +dynamictp: + enabled: true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + monitorInterval: 5 + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + - platform: email + receivers: 123456@qq.com,789789@qq.com # 收件人 + rocketMqTp: # rocketmq 线程池配置 + - threadPoolName: group#topic # 名称规则:group + "#" + topic + corePoolSize: 200 + maximumPoolSize: 200 + keepAliveTime: 60 rocketmq: name-server: 127.0.0.1:9876 diff --git a/example/example-adapter/example-adapter-webserver/src/main/resources/application.yml b/example/example-adapter/example-adapter-webserver/src/main/resources/application.yml index 54d8b6cf8..91e1bae18 100644 --- a/example/example-adapter/example-adapter-webserver/src/main/resources/application.yml +++ b/example/example-adapter/example-adapter-webserver/src/main/resources/application.yml @@ -27,45 +27,44 @@ spring: enable: true debug: false - dynamic: - tp: - enabled: true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: logging,micrometer # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - monitorInterval: 5 - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 32d7bf40-1353-4859 # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: a05f38f61fdc748df55957c # 替换 - secret: SEC0e93872f969493536 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - - platform: email - receivers: 123456@qq.com,789789@qq.com # 收件人 - tomcatTp: # tomcat webserver 线程池配置 - corePoolSize: 100 - maximumPoolSize: 200 - keepAliveTime: 60 - runTimeout: 200 - queueTimeout: 100 +dynamictp: + enabled: true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: logging,micrometer # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + monitorInterval: 5 + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 32d7bf40-1353-4859 # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: a05f38f61fdc748df55957c # 替换 + secret: SEC0e93872f969493536 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + - platform: email + receivers: 123456@qq.com,789789@qq.com # 收件人 + tomcatTp: # tomcat webserver 线程池配置 + corePoolSize: 100 + maximumPoolSize: 200 + keepAliveTime: 60 + runTimeout: 200 + queueTimeout: 100 - jettyTp: # jetty webserver 线程池配置 - corePoolSize: 100 - maximumPoolSize: 200 - keepAliveTime: 60 - runTimeout: 200 - queueTimeout: 1000 + jettyTp: # jetty webserver 线程池配置 + corePoolSize: 100 + maximumPoolSize: 200 + keepAliveTime: 60 + runTimeout: 200 + queueTimeout: 1000 - undertowTp: # undertow webserver 线程池配置 - corePoolSize: 100 - maximumPoolSize: 200 - keepAliveTime: 60 - runTimeout: 20 - queueTimeout: 10 + undertowTp: # undertow webserver 线程池配置 + corePoolSize: 100 + maximumPoolSize: 200 + keepAliveTime: 60 + runTimeout: 20 + queueTimeout: 10 # 开启 SpringBoot Actuator Endpoint 暴露出DynamicTp指标接口 # 开启 prometheus 指标采集端点 diff --git a/example/example-apollo/src/main/resources/dynamic-tp-apollo-demo-dtp.yml b/example/example-apollo/src/main/resources/dynamic-tp-apollo-demo-dtp.yml index 19aa09329..4ef6440b5 100644 --- a/example/example-apollo/src/main/resources/dynamic-tp-apollo-demo-dtp.yml +++ b/example/example-apollo/src/main/resources/dynamic-tp-apollo-demo-dtp.yml @@ -1,84 +1,82 @@ # 动态线程池配置文件,建议单独开一个文件放到配置中心,字段详解看readme介绍 -spring: - dynamic: - tp: - enabled: true - enabledBanner: true # 是否开启banner打印,默认true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs - monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - tomcatTp: # tomcat web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - jettyTp: # jetty web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - undertowTp: # undertow web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - hystrixTp: # hystrix 线程池配置 - - threadPoolName: hystrix1 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - dubboTp: # dubbo 线程池配置 - - threadPoolName: dubboTp#20880 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - rocketMqTp: # rocketmq 线程池配置 - - threadPoolName: group1#topic1 - corePoolSize: 200 - maximumPoolSize: 400 - keepAliveTime: 60 - executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 - - threadPoolName: dtpExecutor1 - executorType: common # 线程池类型common、eager:适用于io密集型 - corePoolSize: 6 - maximumPoolSize: 8 - queueCapacity: 200 - queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 - rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 - keepAliveTime: 50 - allowCoreThreadTimeOut: false # 是否允许核心线程池超时 - threadNamePrefix: test # 线程名前缀 - waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 - awaitTerminationSeconds: 5 # 单位(s) - preStartAllCoreThreads: false # 是否预热所有核心线程,默认false - runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) - queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) - taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) - - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 80 # 报警阈值 - platforms: [ding,wechat] # 可选配置,不配置默认拿上层platforms配置的所以平台 - interval: 120 # 报警间隔(单位:s) - - type: change - enabled: true - - type: liveness - enabled: true - threshold: 80 - - type: reject - enabled: true - threshold: 1 - - type: run_timeout - enabled: true - threshold: 1 - - type: queue_timeout - enabled: true - threshold: 1 \ No newline at end of file +dynamictp: + enabled: true + enabledBanner: true # 是否开启banner打印,默认true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs + monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + tomcatTp: # tomcat web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + jettyTp: # jetty web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + undertowTp: # undertow web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + hystrixTp: # hystrix 线程池配置 + - threadPoolName: hystrix1 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + dubboTp: # dubbo 线程池配置 + - threadPoolName: dubboTp#20880 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + rocketMqTp: # rocketmq 线程池配置 + - threadPoolName: group1#topic1 + corePoolSize: 200 + maximumPoolSize: 400 + keepAliveTime: 60 + executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 + - threadPoolName: dtpExecutor1 + executorType: common # 线程池类型common、eager:适用于io密集型 + corePoolSize: 6 + maximumPoolSize: 8 + queueCapacity: 200 + queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 + rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 + keepAliveTime: 50 + allowCoreThreadTimeOut: false # 是否允许核心线程池超时 + threadNamePrefix: test # 线程名前缀 + waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 + awaitTerminationSeconds: 5 # 单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) + queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) + taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) + - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 + enabled: true + threshold: 80 # 报警阈值 + platforms: [ding,wechat] # 可选配置,不配置默认拿上层platforms配置的所以平台 + interval: 120 # 报警间隔(单位:s) + - type: change + enabled: true + - type: liveness + enabled: true + threshold: 80 + - type: reject + enabled: true + threshold: 1 + - type: run_timeout + enabled: true + threshold: 1 + - type: queue_timeout + enabled: true + threshold: 1 \ No newline at end of file diff --git a/example/example-consul-cloud/src/main/resources/dynamic-tp-cloud-consul-demo-dtp.yml b/example/example-consul-cloud/src/main/resources/dynamic-tp-cloud-consul-demo-dtp.yml index cfb19a1fe..312298f9c 100644 --- a/example/example-consul-cloud/src/main/resources/dynamic-tp-cloud-consul-demo-dtp.yml +++ b/example/example-consul-cloud/src/main/resources/dynamic-tp-cloud-consul-demo-dtp.yml @@ -1,84 +1,82 @@ # 动态线程池配置文件,建议单独开一个文件放到配置中心,字段详解看readme介绍 -spring: - dynamic: - tp: - enabled: true - enabledBanner: true # 是否开启banner打印,默认true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs - monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - tomcatTp: # tomcat web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - jettyTp: # jetty web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - undertowTp: # undertow web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - hystrixTp: # hystrix 线程池配置 - - threadPoolName: hystrix1 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - dubboTp: # dubbo 线程池配置 - - threadPoolName: dubboTp#20880 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - rocketMqTp: # rocketmq 线程池配置 - - threadPoolName: group1#topic1 - corePoolSize: 200 - maximumPoolSize: 400 - keepAliveTime: 60 - executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 - - threadPoolName: dtpExecutor1 - executorType: common # 线程池类型common、eager:适用于io密集型 - corePoolSize: 6 - maximumPoolSize: 8 - queueCapacity: 200 - queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 - rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 - keepAliveTime: 50 - allowCoreThreadTimeOut: false # 是否允许核心线程池超时 - threadNamePrefix: test # 线程名前缀 - waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 - awaitTerminationSeconds: 5 # 单位(s) - preStartAllCoreThreads: false # 是否预热所有核心线程,默认false - runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) - queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) - taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) - - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 80 # 报警阈值 - platforms: [ding,wechat] # 可选配置,不配置默认拿上层platforms配置的所以平台 - interval: 120 # 报警间隔(单位:s) - - type: change - enabled: true - - type: liveness - enabled: true - threshold: 80 - - type: reject - enabled: true - threshold: 1 - - type: run_timeout - enabled: true - threshold: 1 - - type: queue_timeout - enabled: true - threshold: 1 \ No newline at end of file +dynamictp: + enabled: true + enabledBanner: true # 是否开启banner打印,默认true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs + monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + tomcatTp: # tomcat web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + jettyTp: # jetty web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + undertowTp: # undertow web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + hystrixTp: # hystrix 线程池配置 + - threadPoolName: hystrix1 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + dubboTp: # dubbo 线程池配置 + - threadPoolName: dubboTp#20880 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + rocketMqTp: # rocketmq 线程池配置 + - threadPoolName: group1#topic1 + corePoolSize: 200 + maximumPoolSize: 400 + keepAliveTime: 60 + executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 + - threadPoolName: dtpExecutor1 + executorType: common # 线程池类型common、eager:适用于io密集型 + corePoolSize: 6 + maximumPoolSize: 8 + queueCapacity: 200 + queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 + rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 + keepAliveTime: 50 + allowCoreThreadTimeOut: false # 是否允许核心线程池超时 + threadNamePrefix: test # 线程名前缀 + waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 + awaitTerminationSeconds: 5 # 单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) + queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) + taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) + - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 + enabled: true + threshold: 80 # 报警阈值 + platforms: [ding,wechat] # 可选配置,不配置默认拿上层platforms配置的所以平台 + interval: 120 # 报警间隔(单位:s) + - type: change + enabled: true + - type: liveness + enabled: true + threshold: 80 + - type: reject + enabled: true + threshold: 1 + - type: run_timeout + enabled: true + threshold: 1 + - type: queue_timeout + enabled: true + threshold: 1 \ No newline at end of file diff --git a/example/example-etcd/src/main/resources/application.yml b/example/example-etcd/src/main/resources/application.yml index 812c1547a..3c1c7a7de 100644 --- a/example/example-etcd/src/main/resources/application.yml +++ b/example/example-etcd/src/main/resources/application.yml @@ -2,16 +2,16 @@ server: port: 8888 spring: - dynamic: - tp: - config-type: properties - etcd: - endpoints: http://127.0.0.1:2379 - auth-enable: false - key: /config/dynamic-tp-etcd-demo application: name: dynamic-tp-etcd-demo +dynamictp: + config-type: properties + etcd: + endpoints: http://127.0.0.1:2379 + auth-enable: false + key: /config/dynamic-tp-etcd-demo + # 开启 SpringBoot Actuator Endpoint 暴露出DynamicTp指标接口 # 开启 prometheus 指标采集端点 management: diff --git a/example/example-huawei-cloud/src/main/resources/dynamic-tp-huawei-cloud-demo-dtp-dev.yml b/example/example-huawei-cloud/src/main/resources/dynamic-tp-huawei-cloud-demo-dtp-dev.yml index 32d412772..02dbb9ba0 100644 --- a/example/example-huawei-cloud/src/main/resources/dynamic-tp-huawei-cloud-demo-dtp-dev.yml +++ b/example/example-huawei-cloud/src/main/resources/dynamic-tp-huawei-cloud-demo-dtp-dev.yml @@ -1,84 +1,82 @@ # 动态线程池配置文件,建议单独开一个文件放到配置中心,字段详解看readme介绍 -spring: - dynamic: - tp: - enabled: true - enabledBanner: true # 是否开启banner打印,默认true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs - monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - tomcatTp: # tomcat web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - jettyTp: # jetty web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - undertowTp: # undertow web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - hystrixTp: # hystrix 线程池配置 - - threadPoolName: hystrix1 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - dubboTp: # dubbo 线程池配置 - - threadPoolName: dubboTp#20880 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - rocketMqTp: # rocketmq 线程池配置 - - threadPoolName: group1#topic1 - corePoolSize: 200 - maximumPoolSize: 400 - keepAliveTime: 60 - executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 - - threadPoolName: dtpExecutor1 - executorType: common # 线程池类型common、eager:适用于io密集型 - corePoolSize: 6 - maximumPoolSize: 8 - queueCapacity: 200 - queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 - rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 - keepAliveTime: 50 - allowCoreThreadTimeOut: false # 是否允许核心线程池超时 - threadNamePrefix: test # 线程名前缀 - waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 - awaitTerminationSeconds: 5 # 单位(s) - preStartAllCoreThreads: false # 是否预热所有核心线程,默认false - runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) - queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) - taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) - - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 80 # 报警阈值 - platforms: [ding,wechat] # 可选配置,不配置默认拿上层platforms配置的所以平台 - interval: 120 # 报警间隔(单位:s) - - type: change - enabled: true - - type: liveness - enabled: true - threshold: 80 - - type: reject - enabled: true - threshold: 1 - - type: run_timeout - enabled: true - threshold: 1 - - type: queue_timeout - enabled: true - threshold: 1 +dynamictp: + enabled: true + enabledBanner: true # 是否开启banner打印,默认true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs + monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + tomcatTp: # tomcat web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + jettyTp: # jetty web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + undertowTp: # undertow web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + hystrixTp: # hystrix 线程池配置 + - threadPoolName: hystrix1 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + dubboTp: # dubbo 线程池配置 + - threadPoolName: dubboTp#20880 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + rocketMqTp: # rocketmq 线程池配置 + - threadPoolName: group1#topic1 + corePoolSize: 200 + maximumPoolSize: 400 + keepAliveTime: 60 + executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 + - threadPoolName: dtpExecutor1 + executorType: common # 线程池类型common、eager:适用于io密集型 + corePoolSize: 6 + maximumPoolSize: 8 + queueCapacity: 200 + queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 + rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 + keepAliveTime: 50 + allowCoreThreadTimeOut: false # 是否允许核心线程池超时 + threadNamePrefix: test # 线程名前缀 + waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 + awaitTerminationSeconds: 5 # 单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) + queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) + taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) + - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 + enabled: true + threshold: 80 # 报警阈值 + platforms: [ding,wechat] # 可选配置,不配置默认拿上层platforms配置的所以平台 + interval: 120 # 报警间隔(单位:s) + - type: change + enabled: true + - type: liveness + enabled: true + threshold: 80 + - type: reject + enabled: true + threshold: 1 + - type: run_timeout + enabled: true + threshold: 1 + - type: queue_timeout + enabled: true + threshold: 1 diff --git a/example/example-nacos-cloud/src/main/resources/dynamic-tp-nacos-cloud-demo-dtp-dev.yml b/example/example-nacos-cloud/src/main/resources/dynamic-tp-nacos-cloud-demo-dtp-dev.yml index f685ff628..611a3e9ca 100644 --- a/example/example-nacos-cloud/src/main/resources/dynamic-tp-nacos-cloud-demo-dtp-dev.yml +++ b/example/example-nacos-cloud/src/main/resources/dynamic-tp-nacos-cloud-demo-dtp-dev.yml @@ -1,94 +1,92 @@ # 动态线程池配置文件,建议单独开一个文件放到配置中心,字段详解看readme介绍 -spring: - dynamic: - tp: - enabled: true - enabledBanner: true # 是否开启banner打印,默认true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs - monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - tomcatTp: # tomcat web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - jettyTp: # jetty web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - undertowTp: # undertow web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - hystrixTp: # hystrix 线程池配置 - - threadPoolName: hystrix1 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - dubboTp: # dubbo 线程池配置 - - threadPoolName: dubboTp#20880 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - rocketMqTp: # rocketmq 线程池配置 - - threadPoolName: group1#topic1 - corePoolSize: 200 - maximumPoolSize: 400 - keepAliveTime: 60 - executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 - - threadPoolName: dtpExecutor1 - executorType: common # 线程池类型common、eager:适用于io密集型 - corePoolSize: 6 - maximumPoolSize: 8 - queueCapacity: 200 - queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 - rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 - keepAliveTime: 50 - allowCoreThreadTimeOut: false # 是否允许核心线程池超时 - threadNamePrefix: test # 线程名前缀 - waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 - awaitTerminationSeconds: 5 # 单位(s) - preStartAllCoreThreads: false # 是否预热所有核心线程,默认false - runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) - queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) - taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) - - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 80 # 报警阈值 - platforms: [ding,wechat] # 可选配置,不配置默认拿上层platforms配置的所以平台 - interval: 120 # 报警间隔(单位:s) - - type: change - enabled: true - - type: liveness - enabled: true - threshold: 80 - - type: reject - enabled: true - threshold: 1 - - type: run_timeout - enabled: true - threshold: 1 - - type: queue_timeout - enabled: true - threshold: 1 - - threadPoolName: orderedDtpExecutor - executorType: ordered - corePoolSize: 4 - maximumPoolSize: 6 - queueCapacity: 2000 - queueType: VariableLinkedBlockingQueue - rejectedHandlerType: CallerRunsPolicy - keepAliveTime: 50 - allowCoreThreadTimeOut: false - threadNamePrefix: test +dynamictp: + enabled: true + enabledBanner: true # 是否开启banner打印,默认true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs + monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + tomcatTp: # tomcat web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + jettyTp: # jetty web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + undertowTp: # undertow web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + hystrixTp: # hystrix 线程池配置 + - threadPoolName: hystrix1 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + dubboTp: # dubbo 线程池配置 + - threadPoolName: dubboTp#20880 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + rocketMqTp: # rocketmq 线程池配置 + - threadPoolName: group1#topic1 + corePoolSize: 200 + maximumPoolSize: 400 + keepAliveTime: 60 + executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 + - threadPoolName: dtpExecutor1 + executorType: common # 线程池类型common、eager:适用于io密集型 + corePoolSize: 6 + maximumPoolSize: 8 + queueCapacity: 200 + queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 + rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 + keepAliveTime: 50 + allowCoreThreadTimeOut: false # 是否允许核心线程池超时 + threadNamePrefix: test # 线程名前缀 + waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 + awaitTerminationSeconds: 5 # 单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) + queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) + taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) + - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 + enabled: true + threshold: 80 # 报警阈值 + platforms: [ding,wechat] # 可选配置,不配置默认拿上层platforms配置的所以平台 + interval: 120 # 报警间隔(单位:s) + - type: change + enabled: true + - type: liveness + enabled: true + threshold: 80 + - type: reject + enabled: true + threshold: 1 + - type: run_timeout + enabled: true + threshold: 1 + - type: queue_timeout + enabled: true + threshold: 1 + - threadPoolName: orderedDtpExecutor + executorType: ordered + corePoolSize: 4 + maximumPoolSize: 6 + queueCapacity: 2000 + queueType: VariableLinkedBlockingQueue + rejectedHandlerType: CallerRunsPolicy + keepAliveTime: 50 + allowCoreThreadTimeOut: false + threadNamePrefix: test diff --git a/example/example-nacos/src/main/resources/dynamic-tp-nacos-demo-dtp-dev.yml b/example/example-nacos/src/main/resources/dynamic-tp-nacos-demo-dtp-dev.yml index 74d407cb6..933d9a96d 100644 --- a/example/example-nacos/src/main/resources/dynamic-tp-nacos-demo-dtp-dev.yml +++ b/example/example-nacos/src/main/resources/dynamic-tp-nacos-demo-dtp-dev.yml @@ -1,84 +1,82 @@ # 动态线程池配置文件,建议单独开一个文件放到配置中心,字段详解看readme介绍 -spring: - dynamic: - tp: - enabled: true - enabledBanner: true # 是否开启banner打印,默认true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: micrometer,logging,endpoint # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs - monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - tomcatTp: # tomcat web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - jettyTp: # jetty web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - undertowTp: # undertow web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - hystrixTp: # hystrix 线程池配置 - - threadPoolName: hystrix1 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - dubboTp: # dubbo 线程池配置 - - threadPoolName: dubboTp#20880 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - rocketMqTp: # rocketmq 线程池配置 - - threadPoolName: group1#topic1 - corePoolSize: 200 - maximumPoolSize: 400 - keepAliveTime: 60 - executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 - - threadPoolName: dtpExecutorExample1 - executorType: common # 线程池类型common、eager:适用于io密集型 - corePoolSize: 6 - maximumPoolSize: 8 - queueCapacity: 200 - queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 - rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 - keepAliveTime: 50 - allowCoreThreadTimeOut: false # 是否允许核心线程池超时 - threadNamePrefix: test # 线程名前缀 - waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 - awaitTerminationSeconds: 5 # 单位(s) - preStartAllCoreThreads: false # 是否预热所有核心线程,默认false - runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) - queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) - taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) - - type: capacity # 报警项类型,查看源码 NotifyItemEnum枚举类 - enabled: true - threshold: 80 # 报警阈值 - platforms: [ding,wechat] # 可选配置,不配置默认拿上层platforms配置的所有平台 - interval: 120 # 报警间隔(单位:s) - - type: change - enabled: true - - type: liveness - enabled: true - threshold: 80 - - type: reject - enabled: true - threshold: 1 - - type: run_timeout - enabled: true - threshold: 1 - - type: queue_timeout - enabled: true - threshold: 1 +dynamictp: + enabled: true + enabledBanner: true # 是否开启banner打印,默认true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: micrometer,logging,endpoint # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs + monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + tomcatTp: # tomcat web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + jettyTp: # jetty web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + undertowTp: # undertow web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + hystrixTp: # hystrix 线程池配置 + - threadPoolName: hystrix1 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + dubboTp: # dubbo 线程池配置 + - threadPoolName: dubboTp#20880 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + rocketMqTp: # rocketmq 线程池配置 + - threadPoolName: group1#topic1 + corePoolSize: 200 + maximumPoolSize: 400 + keepAliveTime: 60 + executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 + - threadPoolName: dtpExecutorExample1 + executorType: common # 线程池类型common、eager:适用于io密集型 + corePoolSize: 6 + maximumPoolSize: 8 + queueCapacity: 200 + queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 + rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 + keepAliveTime: 50 + allowCoreThreadTimeOut: false # 是否允许核心线程池超时 + threadNamePrefix: test # 线程名前缀 + waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 + awaitTerminationSeconds: 5 # 单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) + queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) + taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) + - type: capacity # 报警项类型,查看源码 NotifyItemEnum枚举类 + enabled: true + threshold: 80 # 报警阈值 + platforms: [ding,wechat] # 可选配置,不配置默认拿上层platforms配置的所有平台 + interval: 120 # 报警间隔(单位:s) + - type: change + enabled: true + - type: liveness + enabled: true + threshold: 80 + - type: reject + enabled: true + threshold: 1 + - type: run_timeout + enabled: true + threshold: 1 + - type: queue_timeout + enabled: true + threshold: 1 diff --git a/example/example-polaris-cloud/src/main/resources/dynamic-tp-polaris-cloud-demo-dtp-dev.yml b/example/example-polaris-cloud/src/main/resources/dynamic-tp-polaris-cloud-demo-dtp-dev.yml index 32d412772..02dbb9ba0 100644 --- a/example/example-polaris-cloud/src/main/resources/dynamic-tp-polaris-cloud-demo-dtp-dev.yml +++ b/example/example-polaris-cloud/src/main/resources/dynamic-tp-polaris-cloud-demo-dtp-dev.yml @@ -1,84 +1,82 @@ # 动态线程池配置文件,建议单独开一个文件放到配置中心,字段详解看readme介绍 -spring: - dynamic: - tp: - enabled: true - enabledBanner: true # 是否开启banner打印,默认true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs - monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - tomcatTp: # tomcat web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - jettyTp: # jetty web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - undertowTp: # undertow web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - hystrixTp: # hystrix 线程池配置 - - threadPoolName: hystrix1 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - dubboTp: # dubbo 线程池配置 - - threadPoolName: dubboTp#20880 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - rocketMqTp: # rocketmq 线程池配置 - - threadPoolName: group1#topic1 - corePoolSize: 200 - maximumPoolSize: 400 - keepAliveTime: 60 - executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 - - threadPoolName: dtpExecutor1 - executorType: common # 线程池类型common、eager:适用于io密集型 - corePoolSize: 6 - maximumPoolSize: 8 - queueCapacity: 200 - queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 - rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 - keepAliveTime: 50 - allowCoreThreadTimeOut: false # 是否允许核心线程池超时 - threadNamePrefix: test # 线程名前缀 - waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 - awaitTerminationSeconds: 5 # 单位(s) - preStartAllCoreThreads: false # 是否预热所有核心线程,默认false - runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) - queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) - taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) - - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 80 # 报警阈值 - platforms: [ding,wechat] # 可选配置,不配置默认拿上层platforms配置的所以平台 - interval: 120 # 报警间隔(单位:s) - - type: change - enabled: true - - type: liveness - enabled: true - threshold: 80 - - type: reject - enabled: true - threshold: 1 - - type: run_timeout - enabled: true - threshold: 1 - - type: queue_timeout - enabled: true - threshold: 1 +dynamictp: + enabled: true + enabledBanner: true # 是否开启banner打印,默认true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs + monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + tomcatTp: # tomcat web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + jettyTp: # jetty web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + undertowTp: # undertow web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + hystrixTp: # hystrix 线程池配置 + - threadPoolName: hystrix1 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + dubboTp: # dubbo 线程池配置 + - threadPoolName: dubboTp#20880 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + rocketMqTp: # rocketmq 线程池配置 + - threadPoolName: group1#topic1 + corePoolSize: 200 + maximumPoolSize: 400 + keepAliveTime: 60 + executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 + - threadPoolName: dtpExecutor1 + executorType: common # 线程池类型common、eager:适用于io密集型 + corePoolSize: 6 + maximumPoolSize: 8 + queueCapacity: 200 + queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 + rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 + keepAliveTime: 50 + allowCoreThreadTimeOut: false # 是否允许核心线程池超时 + threadNamePrefix: test # 线程名前缀 + waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 + awaitTerminationSeconds: 5 # 单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) + queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) + taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) + - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 + enabled: true + threshold: 80 # 报警阈值 + platforms: [ding,wechat] # 可选配置,不配置默认拿上层platforms配置的所以平台 + interval: 120 # 报警间隔(单位:s) + - type: change + enabled: true + - type: liveness + enabled: true + threshold: 80 + - type: reject + enabled: true + threshold: 1 + - type: run_timeout + enabled: true + threshold: 1 + - type: queue_timeout + enabled: true + threshold: 1 diff --git a/example/example-zookeeper-cloud/src/main/resources/config.txt b/example/example-zookeeper-cloud/src/main/resources/config.txt index 82f45e196..12c02bd94 100644 --- a/example/example-zookeeper-cloud/src/main/resources/config.txt +++ b/example/example-zookeeper-cloud/src/main/resources/config.txt @@ -1,69 +1,69 @@ -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.enabled=true -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.enabledBanner=true -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.enabledCollect=true -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.collectorType=logging -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.monitorInterval=5 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].threadPoolName=dtpExecutor1 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].corePoolSize=50 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].maximumPoolSize=50 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].queueCapacity=3000 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].queueType=VariableLinkedBlockingQueue -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].rejectedHandlerType=CallerRunsPolicy -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].keepAliveTime=50 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].allowCoreThreadTimeOut=true -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].threadNamePrefix=test1 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].notifyItems[0].type=capacity -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].notifyItems[0].enabled=true -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].notifyItems[0].threshold=80 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].notifyItems[0].platforms[0]=ding -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].notifyItems[0].platforms[1]=wechat -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].notifyItems[0].interval=120 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].notifyItems[1].type=change -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].notifyItems[1].enabled=true -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].notifyItems[2].type=liveness -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].notifyItems[2].enabled=true -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].notifyItems[2].threshold=80 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].notifyItems[3].type=reject -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].notifyItems[3].enabled=true -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[0].notifyItems[3].threshold=1 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].threadPoolName=dtpExecutor2 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].corePoolSize=20 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].maximumPoolSize=30 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].queueCapacity=1000 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].queueType=VariableLinkedBlockingQueue -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].rejectedHandlerType=CallerRunsPolicy -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].keepAliveTime=50 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].allowCoreThreadTimeOut=true -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].threadNamePrefix=test2 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].notifyItems[0].type=capacity -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].notifyItems[0].enabled=true -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].notifyItems[0].threshold=80 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].notifyItems[0].platforms[0]=ding -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].notifyItems[0].platforms[1]=wechat -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].notifyItems[0].interval=120 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].notifyItems[1].type=change -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].notifyItems[1].enabled=true -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].notifyItems[2].type=liveness -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].notifyItems[2].enabled=true -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].notifyItems[2].threshold=80 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].notifyItems[3].type=reject -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].notifyItems[3].enabled=true -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.executors[1].notifyItems[3].threshold=1 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.enabled=true +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.enabledBanner=true +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.enabledCollect=true +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.collectorType=logging +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.monitorInterval=5 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].threadPoolName=dtpExecutor1 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].corePoolSize=50 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].maximumPoolSize=50 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].queueCapacity=3000 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].queueType=VariableLinkedBlockingQueue +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].rejectedHandlerType=CallerRunsPolicy +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].keepAliveTime=50 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].allowCoreThreadTimeOut=true +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].threadNamePrefix=test1 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].notifyItems[0].type=capacity +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].notifyItems[0].enabled=true +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].notifyItems[0].threshold=80 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].notifyItems[0].platforms[0]=ding +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].notifyItems[0].platforms[1]=wechat +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].notifyItems[0].interval=120 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].notifyItems[1].type=change +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].notifyItems[1].enabled=true +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].notifyItems[2].type=liveness +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].notifyItems[2].enabled=true +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].notifyItems[2].threshold=80 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].notifyItems[3].type=reject +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].notifyItems[3].enabled=true +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[0].notifyItems[3].threshold=1 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].threadPoolName=dtpExecutor2 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].corePoolSize=20 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].maximumPoolSize=30 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].queueCapacity=1000 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].queueType=VariableLinkedBlockingQueue +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].rejectedHandlerType=CallerRunsPolicy +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].keepAliveTime=50 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].allowCoreThreadTimeOut=true +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].threadNamePrefix=test2 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].notifyItems[0].type=capacity +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].notifyItems[0].enabled=true +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].notifyItems[0].threshold=80 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].notifyItems[0].platforms[0]=ding +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].notifyItems[0].platforms[1]=wechat +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].notifyItems[0].interval=120 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].notifyItems[1].type=change +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].notifyItems[1].enabled=true +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].notifyItems[2].type=liveness +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].notifyItems[2].enabled=true +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].notifyItems[2].threshold=80 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].notifyItems[3].type=reject +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].notifyItems[3].enabled=true +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.executors[1].notifyItems[3].threshold=1 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.platforms[0].platform=wechat -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.platforms[0].urlKey=38a7e53d8b649c -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.platforms[0].receivers=test -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.platforms[1].platform=ding -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.platforms[1].urlKey=f80dad44d4a8801d593604f4a08dcd6a -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.platforms[1].secret=SECb5444f2c8346741fa6f375d5b9d21 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.platforms[1].receivers=18888888888 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.platforms[0].platform=wechat +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.platforms[0].urlKey=38a7e53d8b649c +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.platforms[0].receivers=test +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.platforms[1].platform=ding +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.platforms[1].urlKey=f80dad44d4a8801d593604f4a08dcd6a +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.platforms[1].secret=SECb5444f2c8346741fa6f375d5b9d21 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.platforms[1].receivers=18888888888 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.dubboTp[0].threadPoolName=dubboTp#20880 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.dubboTp[0].corePoolSize=100 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.dubboTp[0].maximumPoolSize=400 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.dubboTp[0].keepAliveTime=40 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.dubboTp[0].threadPoolName=dubboTp#20880 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.dubboTp[0].corePoolSize=100 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.dubboTp[0].maximumPoolSize=400 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.dubboTp[0].keepAliveTime=40 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.rocketMqTp[0].threadPoolName=test#test -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.rocketMqTp[0].corePoolSize=100 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.rocketMqTp[0].maximumPoolSize=400 -/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=spring.dynamic.tp.rocketMqTp[0].keepAliveTime=40 \ No newline at end of file +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.rocketMqTp[0].threadPoolName=test#test +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.rocketMqTp[0].corePoolSize=100 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.rocketMqTp[0].maximumPoolSize=400 +/configserver/dev/dynamic-tp-cloud-zookeeper-demo,dev=dynamictp.rocketMqTp[0].keepAliveTime=40 \ No newline at end of file diff --git a/example/example-zookeeper/src/main/resources/application.yml b/example/example-zookeeper/src/main/resources/application.yml index d565eaf49..b56333410 100644 --- a/example/example-zookeeper/src/main/resources/application.yml +++ b/example/example-zookeeper/src/main/resources/application.yml @@ -4,14 +4,14 @@ server: spring: application: name: dynamic-tp-zookeeper-demo - dynamic: - tp: - config-type: json # zookeeper支持properties / json 配置 - zookeeper: - zk-connect-str: 127.0.0.1:2181 - root-node: /configserver/dev - node: dtp-group - config-key: dynamic-tp-zookeeper-demo-json # json 用到 + +dynamictp: + config-type: json # zookeeper支持properties / json 配置 + zookeeper: + zk-connect-str: 127.0.0.1:2181 + root-node: /configserver/dev + node: dtp-group + config-key: dynamic-tp-zookeeper-demo-json # json 用到 # 开启 SpringBoot Actuator Endpoint 暴露出DynamicTp指标接口 # 开启 prometheus 指标采集端点 diff --git a/example/example-zookeeper/src/main/resources/config.txt b/example/example-zookeeper/src/main/resources/config.txt index a06a90193..952a2fba8 100644 --- a/example/example-zookeeper/src/main/resources/config.txt +++ b/example/example-zookeeper/src/main/resources/config.txt @@ -1,51 +1,51 @@ -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.enabled=true -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.enabledBanner=true -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.enabledCollect=true -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.collectorType=logging -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.monitorInterval=5 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].threadPoolName=dtpExecutor1 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].corePoolSize=50 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].maximumPoolSize=50 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].queueCapacity=3000 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].queueType=VariableLinkedBlockingQueue -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].rejectedHandlerType=CallerRunsPolicy -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].keepAliveTime=50 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].allowCoreThreadTimeOut=false -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].threadNamePrefix=test1 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].notifyItems[0].type=capacity -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].notifyItems[0].enabled=false -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].notifyItems[0].threshold=80 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].notifyItems[0].platforms[0]=ding -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].notifyItems[0].platforms[1]=wechat -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].notifyItems[0].interval=120 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].notifyItems[1].type=change -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].notifyItems[1].enabled=false -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].notifyItems[2].type=liveness -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].notifyItems[2].enabled=false -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].notifyItems[2].threshold=80 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].notifyItems[3].type=reject -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].notifyItems[3].enabled=false -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[0].notifyItems[3].threshold=1 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].threadPoolName=dtpExecutor2 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].corePoolSize=20 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].maximumPoolSize=30 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].queueCapacity=1000 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].queueType=VariableLinkedBlockingQueue -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].rejectedHandlerType=CallerRunsPolicy -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].keepAliveTime=50 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].allowCoreThreadTimeOut=false -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].threadNamePrefix=test2 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].notifyItems[0].type=capacity -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].notifyItems[0].enabled=false -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].notifyItems[0].threshold=80 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].notifyItems[0].platforms[0]=ding -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].notifyItems[0].platforms[1]=wechat -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].notifyItems[0].interval=120 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].notifyItems[1].type=change -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].notifyItems[1].enabled=false -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].notifyItems[2].type=liveness -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].notifyItems[2].enabled=false -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].notifyItems[2].threshold=80 -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].notifyItems[3].type=reject -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].notifyItems[3].enabled=false -/configserver/dev/dynamic-tp-zookeeper-demo=spring.dynamic.tp.executors[1].notifyItems[3].threshold=1 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.enabled=true +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.enabledBanner=true +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.enabledCollect=true +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.collectorType=logging +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.monitorInterval=5 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].threadPoolName=dtpExecutor1 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].corePoolSize=50 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].maximumPoolSize=50 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].queueCapacity=3000 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].queueType=VariableLinkedBlockingQueue +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].rejectedHandlerType=CallerRunsPolicy +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].keepAliveTime=50 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].allowCoreThreadTimeOut=false +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].threadNamePrefix=test1 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].notifyItems[0].type=capacity +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].notifyItems[0].enabled=false +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].notifyItems[0].threshold=80 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].notifyItems[0].platforms[0]=ding +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].notifyItems[0].platforms[1]=wechat +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].notifyItems[0].interval=120 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].notifyItems[1].type=change +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].notifyItems[1].enabled=false +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].notifyItems[2].type=liveness +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].notifyItems[2].enabled=false +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].notifyItems[2].threshold=80 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].notifyItems[3].type=reject +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].notifyItems[3].enabled=false +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[0].notifyItems[3].threshold=1 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].threadPoolName=dtpExecutor2 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].corePoolSize=20 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].maximumPoolSize=30 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].queueCapacity=1000 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].queueType=VariableLinkedBlockingQueue +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].rejectedHandlerType=CallerRunsPolicy +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].keepAliveTime=50 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].allowCoreThreadTimeOut=false +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].threadNamePrefix=test2 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].notifyItems[0].type=capacity +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].notifyItems[0].enabled=false +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].notifyItems[0].threshold=80 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].notifyItems[0].platforms[0]=ding +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].notifyItems[0].platforms[1]=wechat +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].notifyItems[0].interval=120 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].notifyItems[1].type=change +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].notifyItems[1].enabled=false +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].notifyItems[2].type=liveness +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].notifyItems[2].enabled=false +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].notifyItems[2].threshold=80 +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].notifyItems[3].type=reject +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].notifyItems[3].enabled=false +/configserver/dev/dynamic-tp-zookeeper-demo=dynamictp.executors[1].notifyItems[3].threshold=1 diff --git a/example/example-zookeeper/src/main/resources/dynamic-tp-zookeeper-demo.properties b/example/example-zookeeper/src/main/resources/dynamic-tp-zookeeper-demo.properties index fdf9854c5..3ddc80f32 100644 --- a/example/example-zookeeper/src/main/resources/dynamic-tp-zookeeper-demo.properties +++ b/example/example-zookeeper/src/main/resources/dynamic-tp-zookeeper-demo.properties @@ -1,51 +1,51 @@ -spring.dynamic.tp.enabled=true -spring.dynamic.tp.enabledBanner=true -spring.dynamic.tp.enabledCollect=true -spring.dynamic.tp.collectorType=logging -spring.dynamic.tp.monitorInterval=5 -spring.dynamic.tp.executors[0].threadPoolName=dynamic-tp-test-1 -spring.dynamic.tp.executors[0].corePoolSize=50 -spring.dynamic.tp.executors[0].maximumPoolSize=50 -spring.dynamic.tp.executors[0].queueCapacity=3000 -spring.dynamic.tp.executors[0].queueType=VariableLinkedBlockingQueue -spring.dynamic.tp.executors[0].rejectedHandlerType=CallerRunsPolicy -spring.dynamic.tp.executors[0].keepAliveTime=50 -spring.dynamic.tp.executors[0].allowCoreThreadTimeOut=false -spring.dynamic.tp.executors[0].threadNamePrefix=test1 -spring.dynamic.tp.executors[0].notifyItems[0].type=capacity -spring.dynamic.tp.executors[0].notifyItems[0].enabled=false -spring.dynamic.tp.executors[0].notifyItems[0].threshold=80 -spring.dynamic.tp.executors[0].notifyItems[0].platforms[0]=ding -spring.dynamic.tp.executors[0].notifyItems[0].platforms[1]=wechat -spring.dynamic.tp.executors[0].notifyItems[0].interval=120 -spring.dynamic.tp.executors[0].notifyItems[1].type=change -spring.dynamic.tp.executors[0].notifyItems[1].enabled=false -spring.dynamic.tp.executors[0].notifyItems[2].type=liveness -spring.dynamic.tp.executors[0].notifyItems[2].enabled=false -spring.dynamic.tp.executors[0].notifyItems[2].threshold=80 -spring.dynamic.tp.executors[0].notifyItems[3].type=reject -spring.dynamic.tp.executors[0].notifyItems[3].enabled=false -spring.dynamic.tp.executors[0].notifyItems[3].threshold=1 -spring.dynamic.tp.executors[1].threadPoolName=dynamic-tp-test-2 -spring.dynamic.tp.executors[1].corePoolSize=20 -spring.dynamic.tp.executors[1].maximumPoolSize=30 -spring.dynamic.tp.executors[1].queueCapacity=1000 -spring.dynamic.tp.executors[1].queueType=VariableLinkedBlockingQueue -spring.dynamic.tp.executors[1].rejectedHandlerType=CallerRunsPolicy -spring.dynamic.tp.executors[1].keepAliveTime=50 -spring.dynamic.tp.executors[1].allowCoreThreadTimeOut=false -spring.dynamic.tp.executors[1].threadNamePrefix=test2 -spring.dynamic.tp.executors[1].notifyItems[0].type=capacity -spring.dynamic.tp.executors[1].notifyItems[0].enabled=false -spring.dynamic.tp.executors[1].notifyItems[0].threshold=80 -spring.dynamic.tp.executors[1].notifyItems[0].platforms[0]=ding -spring.dynamic.tp.executors[1].notifyItems[0].platforms[1]=wechat -spring.dynamic.tp.executors[1].notifyItems[0].interval=120 -spring.dynamic.tp.executors[1].notifyItems[1].type=change -spring.dynamic.tp.executors[1].notifyItems[1].enabled=false -spring.dynamic.tp.executors[1].notifyItems[2].type=liveness -spring.dynamic.tp.executors[1].notifyItems[2].enabled=false -spring.dynamic.tp.executors[1].notifyItems[2].threshold=80 -spring.dynamic.tp.executors[1].notifyItems[3].type=reject -spring.dynamic.tp.executors[1].notifyItems[3].enabled=false -spring.dynamic.tp.executors[1].notifyItems[3].threshold=1 +dynamictp.enabled=true +dynamictp.enabledBanner=true +dynamictp.enabledCollect=true +dynamictp.collectorType=logging +dynamictp.monitorInterval=5 +dynamictp.executors[0].threadPoolName=dynamic-tp-test-1 +dynamictp.executors[0].corePoolSize=50 +dynamictp.executors[0].maximumPoolSize=50 +dynamictp.executors[0].queueCapacity=3000 +dynamictp.executors[0].queueType=VariableLinkedBlockingQueue +dynamictp.executors[0].rejectedHandlerType=CallerRunsPolicy +dynamictp.executors[0].keepAliveTime=50 +dynamictp.executors[0].allowCoreThreadTimeOut=false +dynamictp.executors[0].threadNamePrefix=test1 +dynamictp.executors[0].notifyItems[0].type=capacity +dynamictp.executors[0].notifyItems[0].enabled=false +dynamictp.executors[0].notifyItems[0].threshold=80 +dynamictp.executors[0].notifyItems[0].platforms[0]=ding +dynamictp.executors[0].notifyItems[0].platforms[1]=wechat +dynamictp.executors[0].notifyItems[0].interval=120 +dynamictp.executors[0].notifyItems[1].type=change +dynamictp.executors[0].notifyItems[1].enabled=false +dynamictp.executors[0].notifyItems[2].type=liveness +dynamictp.executors[0].notifyItems[2].enabled=false +dynamictp.executors[0].notifyItems[2].threshold=80 +dynamictp.executors[0].notifyItems[3].type=reject +dynamictp.executors[0].notifyItems[3].enabled=false +dynamictp.executors[0].notifyItems[3].threshold=1 +dynamictp.executors[1].threadPoolName=dynamic-tp-test-2 +dynamictp.executors[1].corePoolSize=20 +dynamictp.executors[1].maximumPoolSize=30 +dynamictp.executors[1].queueCapacity=1000 +dynamictp.executors[1].queueType=VariableLinkedBlockingQueue +dynamictp.executors[1].rejectedHandlerType=CallerRunsPolicy +dynamictp.executors[1].keepAliveTime=50 +dynamictp.executors[1].allowCoreThreadTimeOut=false +dynamictp.executors[1].threadNamePrefix=test2 +dynamictp.executors[1].notifyItems[0].type=capacity +dynamictp.executors[1].notifyItems[0].enabled=false +dynamictp.executors[1].notifyItems[0].threshold=80 +dynamictp.executors[1].notifyItems[0].platforms[0]=ding +dynamictp.executors[1].notifyItems[0].platforms[1]=wechat +dynamictp.executors[1].notifyItems[0].interval=120 +dynamictp.executors[1].notifyItems[1].type=change +dynamictp.executors[1].notifyItems[1].enabled=false +dynamictp.executors[1].notifyItems[2].type=liveness +dynamictp.executors[1].notifyItems[2].enabled=false +dynamictp.executors[1].notifyItems[2].threshold=80 +dynamictp.executors[1].notifyItems[3].type=reject +dynamictp.executors[1].notifyItems[3].enabled=false +dynamictp.executors[1].notifyItems[3].threshold=1 diff --git a/starter/starter-common/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/starter/starter-common/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 75dd785bc..577377a2a 100644 --- a/starter/starter-common/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/starter/starter-common/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -1,514 +1,514 @@ { "groups": [ { - "name": "spring.dynamic.tp", + "name": "dynamictp", "type": "org.dromara.dynamictp.common.properties.DtpProperties", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.etcd", + "name": "dynamictp.etcd", "type": "org.dromara.dynamictp.common.properties.DtpProperties$Etcd", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.jetty-tp", + "name": "dynamictp.jetty-tp", "type": "org.dromara.dynamictp.common.entity.TpExecutorProps", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.tomcat-tp", + "name": "dynamictp.tomcat-tp", "type": "org.dromara.dynamictp.common.entity.TpExecutorProps", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.undertow-tp", + "name": "dynamictp.undertow-tp", "type": "org.dromara.dynamictp.common.entity.TpExecutorProps", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.zookeeper", + "name": "dynamictp.zookeeper", "type": "org.dromara.dynamictp.common.properties.DtpProperties$Zookeeper", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" } ], "properties": [ { - "name": "spring.dynamic.tp.brpc-tp", + "name": "dynamictp.brpc-tp", "type": "java.util.List", "description": "Brpc thread pools.", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.collector-types", + "name": "dynamictp.collector-types", "type": "java.util.List", "description": "Metrics collector types, default is logging. see {@link CollectorTypeEnum}", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.config-type", + "name": "dynamictp.config-type", "type": "java.lang.String", "description": "Config file type, for zookeeper and etcd.", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.dubbo-tp", + "name": "dynamictp.dubbo-tp", "type": "java.util.List", "description": "Dubbo thread pools.", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.enabled", + "name": "dynamictp.enabled", "type": "java.lang.Boolean", "description": "If enabled DynamicTp.", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties", "defaultValue": true }, { - "name": "spring.dynamic.tp.enabled-banner", + "name": "dynamictp.enabled-banner", "type": "java.lang.Boolean", "description": "If print banner.", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties", "defaultValue": true }, { - "name": "spring.dynamic.tp.enabled-collect", + "name": "dynamictp.enabled-collect", "type": "java.lang.Boolean", "description": "If enabled metrics collect.", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties", "defaultValue": true }, { - "name": "spring.dynamic.tp.etcd.auth-enable", + "name": "dynamictp.etcd.auth-enable", "type": "java.lang.Boolean", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties$Etcd", "defaultValue": false }, { - "name": "spring.dynamic.tp.etcd.authority", + "name": "dynamictp.etcd.authority", "type": "java.lang.String", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties$Etcd", "defaultValue": "ssl" }, { - "name": "spring.dynamic.tp.etcd.charset", + "name": "dynamictp.etcd.charset", "type": "java.lang.String", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties$Etcd", "defaultValue": "UTF-8" }, { - "name": "spring.dynamic.tp.etcd.endpoints", + "name": "dynamictp.etcd.endpoints", "type": "java.lang.String", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties$Etcd" }, { - "name": "spring.dynamic.tp.etcd.key", + "name": "dynamictp.etcd.key", "type": "java.lang.String", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties$Etcd" }, { - "name": "spring.dynamic.tp.etcd.password", + "name": "dynamictp.etcd.password", "type": "java.lang.String", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties$Etcd" }, { - "name": "spring.dynamic.tp.etcd.user", + "name": "dynamictp.etcd.user", "type": "java.lang.String", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties$Etcd" }, { - "name": "spring.dynamic.tp.executors", + "name": "dynamictp.executors", "type": "java.util.List", "description": "ThreadPoolExecutor configs.", "sourceType": "org.dromara.dynamictp.common.entity.DtpExecutorProps" }, { - "name": "spring.dynamic.tp.grpc-tp", + "name": "dynamictp.grpc-tp", "type": "java.util.List", "description": "Grpc thread pools.", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.hystrix-tp", + "name": "dynamictp.hystrix-tp", "type": "java.util.List", "description": "Hystrix thread pools.", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.jetty-tp.aware-names", + "name": "dynamictp.jetty-tp.aware-names", "type": "java.util.List", "description": "Aware names.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.jetty-tp.core-pool-size", + "name": "dynamictp.jetty-tp.core-pool-size", "type": "java.lang.Integer", "description": "CoreSize of ThreadPool.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps", "defaultValue": 1 }, { - "name": "spring.dynamic.tp.jetty-tp.keep-alive-time", + "name": "dynamictp.jetty-tp.keep-alive-time", "type": "java.lang.Long", "description": "When the number of threads is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps", "defaultValue": 60 }, { - "name": "spring.dynamic.tp.jetty-tp.maximum-pool-size", + "name": "dynamictp.jetty-tp.maximum-pool-size", "type": "java.lang.Integer", "description": "MaxSize of ThreadPool.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.jetty-tp.notify-enabled", + "name": "dynamictp.jetty-tp.notify-enabled", "type": "java.lang.Boolean", "description": "If enable notify.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps", "defaultValue": true }, { - "name": "spring.dynamic.tp.jetty-tp.notify-items", + "name": "dynamictp.jetty-tp.notify-items", "type": "java.util.List", "description": "Notify items, see {@link NotifyItemEnum}", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.jetty-tp.platform-ids", + "name": "dynamictp.jetty-tp.platform-ids", "type": "java.util.List", "description": "Notify platform id", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.jetty-tp.queue-timeout", + "name": "dynamictp.jetty-tp.queue-timeout", "type": "java.lang.Long", "description": "Task queue wait timeout, unit (ms), just for statistics.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps", "defaultValue": 0 }, { - "name": "spring.dynamic.tp.jetty-tp.run-timeout", + "name": "dynamictp.jetty-tp.run-timeout", "type": "java.lang.Long", "description": "Task execute timeout, unit (ms), just for statistics.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps", "defaultValue": 0 }, { - "name": "spring.dynamic.tp.jetty-tp.task-wrapper-names", + "name": "dynamictp.jetty-tp.task-wrapper-names", "type": "java.util.Set", "description": "Task wrapper names.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.jetty-tp.thread-pool-alias-name", + "name": "dynamictp.jetty-tp.thread-pool-alias-name", "type": "java.lang.String", "description": "Simple Alias Name of ThreadPool. Use for notify.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.jetty-tp.thread-pool-name", + "name": "dynamictp.jetty-tp.thread-pool-name", "type": "java.lang.String", "description": "Name of ThreadPool.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.jetty-tp.unit", + "name": "dynamictp.jetty-tp.unit", "type": "java.util.concurrent.TimeUnit", "description": "Timeout unit.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.log-path", + "name": "dynamictp.log-path", "type": "java.lang.String", "description": "Metrics log storage path, just for \"logging\" type.", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.monitor-interval", + "name": "dynamictp.monitor-interval", "type": "java.lang.Integer", "description": "Monitor interval, time unit(s)", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties", "defaultValue": 5 }, { - "name": "spring.dynamic.tp.motan-tp", + "name": "dynamictp.motan-tp", "type": "java.util.List", "description": "Motan server thread pools.", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.okhttp3-tp", + "name": "dynamictp.okhttp3-tp", "type": "java.util.List", "description": "Okhttp3 thread pools.", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.platforms", + "name": "dynamictp.platforms", "type": "java.util.List", "description": "Notify platform configs.", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.rabbitmq-tp", + "name": "dynamictp.rabbitmq-tp", "type": "java.util.List", "description": "Rabbitmq thread pools.", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.rocket-mq-tp", + "name": "dynamictp.rocket-mq-tp", "type": "java.util.List", "description": "RocketMq thread pools.", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.sofa-tp", + "name": "dynamictp.sofa-tp", "type": "java.util.List", "description": "Sofa thread pools.", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.tars-tp", + "name": "dynamictp.tars-tp", "type": "java.util.List", "description": "Tars thread pools.", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.tomcat-tp.aware-names", + "name": "dynamictp.tomcat-tp.aware-names", "type": "java.util.List", "description": "Aware names.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.tomcat-tp.core-pool-size", + "name": "dynamictp.tomcat-tp.core-pool-size", "type": "java.lang.Integer", "description": "CoreSize of ThreadPool.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps", "defaultValue": 1 }, { - "name": "spring.dynamic.tp.tomcat-tp.keep-alive-time", + "name": "dynamictp.tomcat-tp.keep-alive-time", "type": "java.lang.Long", "description": "When the number of threads is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps", "defaultValue": 60 }, { - "name": "spring.dynamic.tp.tomcat-tp.maximum-pool-size", + "name": "dynamictp.tomcat-tp.maximum-pool-size", "type": "java.lang.Integer", "description": "MaxSize of ThreadPool.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.tomcat-tp.notify-enabled", + "name": "dynamictp.tomcat-tp.notify-enabled", "type": "java.lang.Boolean", "description": "If enable notify.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps", "defaultValue": true }, { - "name": "spring.dynamic.tp.tomcat-tp.notify-items", + "name": "dynamictp.tomcat-tp.notify-items", "type": "java.util.List", "description": "Notify items, see {@link NotifyItemEnum}", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.tomcat-tp.platform-ids", + "name": "dynamictp.tomcat-tp.platform-ids", "type": "java.util.List", "description": "Notify platform id", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.tomcat-tp.queue-timeout", + "name": "dynamictp.tomcat-tp.queue-timeout", "type": "java.lang.Long", "description": "Task queue wait timeout, unit (ms), just for statistics.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps", "defaultValue": 0 }, { - "name": "spring.dynamic.tp.tomcat-tp.run-timeout", + "name": "dynamictp.tomcat-tp.run-timeout", "type": "java.lang.Long", "description": "Task execute timeout, unit (ms), just for statistics.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps", "defaultValue": 0 }, { - "name": "spring.dynamic.tp.tomcat-tp.task-wrapper-names", + "name": "dynamictp.tomcat-tp.task-wrapper-names", "type": "java.util.Set", "description": "Task wrapper names.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.tomcat-tp.thread-pool-alias-name", + "name": "dynamictp.tomcat-tp.thread-pool-alias-name", "type": "java.lang.String", "description": "Simple Alias Name of ThreadPool. Use for notify.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.tomcat-tp.thread-pool-name", + "name": "dynamictp.tomcat-tp.thread-pool-name", "type": "java.lang.String", "description": "Name of ThreadPool.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.tomcat-tp.unit", + "name": "dynamictp.tomcat-tp.unit", "type": "java.util.concurrent.TimeUnit", "description": "Timeout unit.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.undertow-tp.aware-names", + "name": "dynamictp.undertow-tp.aware-names", "type": "java.util.List", "description": "Aware names.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.undertow-tp.core-pool-size", + "name": "dynamictp.undertow-tp.core-pool-size", "type": "java.lang.Integer", "description": "CoreSize of ThreadPool.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps", "defaultValue": 1 }, { - "name": "spring.dynamic.tp.undertow-tp.keep-alive-time", + "name": "dynamictp.undertow-tp.keep-alive-time", "type": "java.lang.Long", "description": "When the number of threads is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps", "defaultValue": 60 }, { - "name": "spring.dynamic.tp.undertow-tp.maximum-pool-size", + "name": "dynamictp.undertow-tp.maximum-pool-size", "type": "java.lang.Integer", "description": "MaxSize of ThreadPool.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.undertow-tp.notify-enabled", + "name": "dynamictp.undertow-tp.notify-enabled", "type": "java.lang.Boolean", "description": "If enable notify.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps", "defaultValue": true }, { - "name": "spring.dynamic.tp.undertow-tp.notify-items", + "name": "dynamictp.undertow-tp.notify-items", "type": "java.util.List", "description": "Notify items, see {@link NotifyItemEnum}", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.undertow-tp.platform-ids", + "name": "dynamictp.undertow-tp.platform-ids", "type": "java.util.List", "description": "Notify platform id", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.undertow-tp.queue-timeout", + "name": "dynamictp.undertow-tp.queue-timeout", "type": "java.lang.Long", "description": "Task queue wait timeout, unit (ms), just for statistics.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps", "defaultValue": 0 }, { - "name": "spring.dynamic.tp.undertow-tp.run-timeout", + "name": "dynamictp.undertow-tp.run-timeout", "type": "java.lang.Long", "description": "Task execute timeout, unit (ms), just for statistics.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps", "defaultValue": 0 }, { - "name": "spring.dynamic.tp.undertow-tp.task-wrapper-names", + "name": "dynamictp.undertow-tp.task-wrapper-names", "type": "java.util.Set", "description": "Task wrapper names.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.undertow-tp.thread-pool-alias-name", + "name": "dynamictp.undertow-tp.thread-pool-alias-name", "type": "java.lang.String", "description": "Simple Alias Name of ThreadPool. Use for notify.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.undertow-tp.thread-pool-name", + "name": "dynamictp.undertow-tp.thread-pool-name", "type": "java.lang.String", "description": "Name of ThreadPool.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.undertow-tp.unit", + "name": "dynamictp.undertow-tp.unit", "type": "java.util.concurrent.TimeUnit", "description": "Timeout unit.", "sourceType": "org.dromara.dynamictp.common.entity.TpExecutorProps" }, { - "name": "spring.dynamic.tp.zookeeper.config-key", + "name": "dynamictp.zookeeper.config-key", "type": "java.lang.String", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties$Zookeeper" }, { - "name": "spring.dynamic.tp.zookeeper.config-version", + "name": "dynamictp.zookeeper.config-version", "type": "java.lang.String", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties$Zookeeper" }, { - "name": "spring.dynamic.tp.zookeeper.node", + "name": "dynamictp.zookeeper.node", "type": "java.lang.String", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties$Zookeeper" }, { - "name": "spring.dynamic.tp.zookeeper.root-node", + "name": "dynamictp.zookeeper.root-node", "type": "java.lang.String", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties$Zookeeper" }, { - "name": "spring.dynamic.tp.zookeeper.zk-connect-str", + "name": "dynamictp.zookeeper.zk-connect-str", "type": "java.lang.String", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties$Zookeeper" }, { - "name": "spring.dynamic.tp.env", + "name": "dynamictp.env", "type": "java.lang.String", "description": "Environment, if not set, will use \"spring.profiles.active\".", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.global-executor-props", + "name": "dynamictp.global-executor-props", "type": "org.dromara.dynamictp.common.entity.DtpExecutorProps", "description": "ThreadPoolExecutor global configs.", "sourceType": "org.dromara.dynamictp.common.properties.DtpProperties" }, { - "name": "spring.dynamic.tp.global-executor-props.executor-type", + "name": "dynamictp.global-executor-props.executor-type", "type": "java.lang.String", "description": "ThreadPoolExecutor type, see {@link ExecutorType}", "sourceType": "org.dromara.dynamictp.common.entity.DtpExecutorProps" }, { - "name": "spring.dynamic.tp.global-executor-props.queue-type", + "name": "dynamictp.global-executor-props.queue-type", "type": "java.lang.String", "description": "ThreadPoolExecutor queue type, see {@link QueueTypeEnum}", "defaultValue": "VariableLinkedBlockingQueue", "sourceType": "org.dromara.dynamictp.common.entity.DtpExecutorProps" }, { - "name": "spring.dynamic.tp.global-executor-props.fair", + "name": "dynamictp.global-executor-props.fair", "type": "java.lang.Boolean", "description": "ThreadPoolExecutor fair.", "defaultValue": false, "sourceType": "org.dromara.dynamictp.common.entity.DtpExecutorProps" }, { - "name": "spring.dynamic.tp.global-executor-props.pre-start-all-core-threads", + "name": "dynamictp.global-executor-props.pre-start-all-core-threads", "type": "java.lang.Boolean", "description": "ThreadPoolExecutor pre start all core threads.", "defaultValue": false, "sourceType": "org.dromara.dynamictp.common.entity.DtpExecutorProps" }, { - "name": "spring.dynamic.tp.global-executor-props.plugin-names", + "name": "dynamictp.global-executor-props.plugin-names", "type": "java.util.Set", "description": "ThreadPoolExecutor plugin names.", "sourceType": "org.dromara.dynamictp.common.entity.DtpExecutorProps" }, { - "name": "spring.dynamic.tp.global-executor-props.auto-create", + "name": "dynamictp.global-executor-props.auto-create", "type": "java.lang.Boolean", "description": "ThreadPoolExecutor auto create.", "defaultValue": true, diff --git a/test/test-configcenter/src/test/java/org/dromara/dynamictp/test/configcenter/apollo/ApolloInitListener.java b/test/test-configcenter/src/test/java/org/dromara/dynamictp/test/configcenter/apollo/ApolloInitListener.java index d1fe9838e..840f47149 100644 --- a/test/test-configcenter/src/test/java/org/dromara/dynamictp/test/configcenter/apollo/ApolloInitListener.java +++ b/test/test-configcenter/src/test/java/org/dromara/dynamictp/test/configcenter/apollo/ApolloInitListener.java @@ -55,9 +55,8 @@ public void environmentPrepared(ConfigurableBootstrapContext bootstrapContext, C YmlConfigFile configFile = (YmlConfigFile) ConfigService.getConfigFile("dynamic-tp-demo-dtp-dev", ConfigFileFormat.YML); Properties newProperties = new Properties(); - String content = "spring:\n" + - " dynamic:\n" + - " tp:\n" + + String content = + "dynamictp:\n" + " enabled: true # 是否启用 dynamictp,默认true\n" + " executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量\n" + " - threadPoolName: dtpExecutor1\n" + diff --git a/test/test-configcenter/src/test/java/org/dromara/dynamictp/test/configcenter/apollo/ApolloRefresherTest.java b/test/test-configcenter/src/test/java/org/dromara/dynamictp/test/configcenter/apollo/ApolloRefresherTest.java index 094c4be45..12f12043c 100644 --- a/test/test-configcenter/src/test/java/org/dromara/dynamictp/test/configcenter/apollo/ApolloRefresherTest.java +++ b/test/test-configcenter/src/test/java/org/dromara/dynamictp/test/configcenter/apollo/ApolloRefresherTest.java @@ -52,9 +52,8 @@ void testRefresh() throws InterruptedException { private void mockConfigChange() { YamlConfigFile configFile = (YamlConfigFile) ConfigService.getConfigFile("dynamic-tp-demo-dtp-dev", ConfigFileFormat.YML); Properties newProperties = new Properties(); - String content = "spring:\n" + - " dynamic:\n" + - " tp:\n" + + String content = + "dynamictp:\n" + " enabled: true # 是否启用 dynamictp,默认true\n" + " executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量\n" + " - threadPoolName: dtpExecutor1\n" + diff --git a/test/test-configcenter/src/test/java/org/dromara/dynamictp/test/configcenter/cloud/CloudRefresherTest.java b/test/test-configcenter/src/test/java/org/dromara/dynamictp/test/configcenter/cloud/CloudRefresherTest.java index 0dfe6be77..98ac64c35 100644 --- a/test/test-configcenter/src/test/java/org/dromara/dynamictp/test/configcenter/cloud/CloudRefresherTest.java +++ b/test/test-configcenter/src/test/java/org/dromara/dynamictp/test/configcenter/cloud/CloudRefresherTest.java @@ -52,12 +52,12 @@ void testCloudRefresh() { private void mockEnvironmentChange() { MutablePropertySources propertySources = this.environment.getPropertySources(); Map tmpMap = Maps.newHashMap(); - tmpMap.put("spring.dynamic.tp.executors[0].threadPoolName", "dtpExecutor1"); - tmpMap.put("spring.dynamic.tp.executors[0].corePoolSize", 10); - tmpMap.put("spring.dynamic.tp.executors[0].maximumPoolSize", 20); + tmpMap.put("dynamictp.executors[0].threadPoolName", "dtpExecutor1"); + tmpMap.put("dynamictp.executors[0].corePoolSize", 10); + tmpMap.put("dynamictp.executors[0].maximumPoolSize", 20); propertySources.addFirst(new MapPropertySource("DtpCloudRefreshTestPropertySource", tmpMap)); - Set keys = Collections.singleton("spring.dynamic.tp.executors[0].corePoolSize"); + Set keys = Collections.singleton("dynamictp.executors[0].corePoolSize"); EnvironmentChangeEvent event = new EnvironmentChangeEvent(keys); this.publisher.publishEvent(event); } diff --git a/test/test-configcenter/src/test/java/org/dromara/dynamictp/test/configcenter/nacos/NacosRefresherTest.java b/test/test-configcenter/src/test/java/org/dromara/dynamictp/test/configcenter/nacos/NacosRefresherTest.java index 4c65ebc3a..ed9a13b45 100644 --- a/test/test-configcenter/src/test/java/org/dromara/dynamictp/test/configcenter/nacos/NacosRefresherTest.java +++ b/test/test-configcenter/src/test/java/org/dromara/dynamictp/test/configcenter/nacos/NacosRefresherTest.java @@ -65,11 +65,10 @@ private void mockConfigChange() { String dataId = "dynamic-tp-demo-dtp-dev.yml"; String groupId = "DEFAULT_GROUP"; String type = ConfigType.YAML.getType(); - String content = "spring:\n" + - " dynamic:\n" + - " tp:\n" + + String content = + "dynamictp:\n" + " enabled: true # 是否启用 dynamictp,默认true\n" + - " executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量\n" + + " executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量\n" + " - threadPoolName: dtpExecutor1\n" + " threadPoolAliasName: 测试线程池 # 线程池别名\n" + " executorType: common # 线程池类型 common、eager、ordered、scheduled,默认 common\n" + diff --git a/test/test-configcenter/src/test/resources/dynamic-tp-demo-dtp-dev.yml b/test/test-configcenter/src/test/resources/dynamic-tp-demo-dtp-dev.yml index 270c84142..f9434610f 100644 --- a/test/test-configcenter/src/test/resources/dynamic-tp-demo-dtp-dev.yml +++ b/test/test-configcenter/src/test/resources/dynamic-tp-demo-dtp-dev.yml @@ -1,75 +1,73 @@ -spring: - dynamic: - tp: - enabled: true # 是否启用 dynamictp,默认true - enabledCollect: true # 是否开启监控指标采集,默认true - collectorTypes: micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - logPath: /home/logs/dynamictp/user-center/ # 监控日志数据路径,默认 ${user.home}/logs,采集类型非logging不用配置 - monitorInterval: 5 # 监控时间间隔(报警检测、指标采集),默认5s - platforms: # 通知报警平台配置 - - platform: wechat - platformId: 1 # 平台id,自定义 - urlKey: 3a700-127-4bd-a798-c53d8b69c # webhook 中的 key - receivers: test1,test2 # 接受人企微账号 +dynamictp: + enabled: true # 是否启用 dynamictp,默认true + enabledCollect: true # 是否开启监控指标采集,默认true + collectorTypes: micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + logPath: /home/logs/dynamictp/user-center/ # 监控日志数据路径,默认 ${user.home}/logs,采集类型非logging不用配置 + monitorInterval: 5 # 监控时间间隔(报警检测、指标采集),默认5s + platforms: # 通知报警平台配置 + - platform: wechat + platformId: 1 # 平台id,自定义 + urlKey: 3a700-127-4bd-a798-c53d8b69c # webhook 中的 key + receivers: test1,test2 # 接受人企微账号 - - platform: ding - platformId: 2 # 平台id,自定义 - urlKey: f80dad441fcd655438f4a08dcd6a # webhook 中的 access_token - secret: SECb5441fa6f375d5b9d21 # 安全设置在验签模式下才的秘钥,非验签模式没有此值 - receivers: 18888888888 # 钉钉账号手机号 + - platform: ding + platformId: 2 # 平台id,自定义 + urlKey: f80dad441fcd655438f4a08dcd6a # webhook 中的 access_token + secret: SECb5441fa6f375d5b9d21 # 安全设置在验签模式下才的秘钥,非验签模式没有此值 + receivers: 18888888888 # 钉钉账号手机号 - - platform: lark - platformId: 3 - urlKey: 0d944ae7-b24a-40 # webhook 中的 token - secret: 3a750012874bdac5c3d8b69c # 安全设置在签名校验模式下才的秘钥,非验签模式没有此值 - receivers: test1,test2 # 接受人username / openid + - platform: lark + platformId: 3 + urlKey: 0d944ae7-b24a-40 # webhook 中的 token + secret: 3a750012874bdac5c3d8b69c # 安全设置在签名校验模式下才的秘钥,非验签模式没有此值 + receivers: test1,test2 # 接受人username / openid - - platform: email - platformId: 4 - receivers: 123456@qq.com,789789@qq.com # 收件人邮箱,多个用逗号隔开 + - platform: email + platformId: 4 + receivers: 123456@qq.com,789789@qq.com # 收件人邮箱,多个用逗号隔开 - executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 - - threadPoolName: dtpExecutor1 - threadPoolAliasName: 测试线程池 # 线程池别名 - executorType: common # 线程池类型 common、eager、ordered、scheduled,默认 common - corePoolSize: 6 # 核心线程数,默认1 - maximumPoolSize: 8 # 最大线程数,默认cpu核数 - queueCapacity: 2000 # 队列容量,默认1024 - queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类,默认VariableLinkedBlockingQueue - rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类,默认AbortPolicy - keepAliveTime: 60 # 空闲线程等待超时时间,默认60 - threadNamePrefix: test # 线程名前缀,默认dtp - allowCoreThreadTimeOut: false # 是否允许核心线程池超时,默认false - waitForTasksToCompleteOnShutdown: true # 参考spring线程池设计,优雅关闭线程池,默认false - awaitTerminationSeconds: 5 # 优雅关闭线程池时,阻塞等待线程池中任务执行时间,默认0,单位(s) - preStartAllCoreThreads: false # 是否预热所有核心线程,默认false - runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms),默认0 - queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms),默认0 - taskWrapperNames: ["ttl", "mdc"] # 任务包装器名称,继承TaskWrapper接口 - notifyEnabled: true # 是否开启报警,默认true - platformIds: [1,2] # 报警平台id,不配置默认拿上层platforms配置的所有平台 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) - - type: change - enabled: true + executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 + - threadPoolName: dtpExecutor1 + threadPoolAliasName: 测试线程池 # 线程池别名 + executorType: common # 线程池类型 common、eager、ordered、scheduled,默认 common + corePoolSize: 6 # 核心线程数,默认1 + maximumPoolSize: 8 # 最大线程数,默认cpu核数 + queueCapacity: 2000 # 队列容量,默认1024 + queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类,默认VariableLinkedBlockingQueue + rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类,默认AbortPolicy + keepAliveTime: 60 # 空闲线程等待超时时间,默认60 + threadNamePrefix: test # 线程名前缀,默认dtp + allowCoreThreadTimeOut: false # 是否允许核心线程池超时,默认false + waitForTasksToCompleteOnShutdown: true # 参考spring线程池设计,优雅关闭线程池,默认false + awaitTerminationSeconds: 5 # 优雅关闭线程池时,阻塞等待线程池中任务执行时间,默认0,单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms),默认0 + queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms),默认0 + taskWrapperNames: ["ttl", "mdc"] # 任务包装器名称,继承TaskWrapper接口 + notifyEnabled: true # 是否开启报警,默认true + platformIds: [1,2] # 报警平台id,不配置默认拿上层platforms配置的所有平台 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) + - type: change + enabled: true - - type: capacity # 队列容量使用率,报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 80 # 报警阈值,默认70,意思是队列使用率达到70%告警 - platformIds: [2] # 可选配置,本配置优先级 > 所属线程池platformIds > 全局配置platforms - interval: 120 # 报警间隔(单位:s),默认120 + - type: capacity # 队列容量使用率,报警项类型,查看源码 NotifyTypeEnum枚举类 + enabled: true + threshold: 80 # 报警阈值,默认70,意思是队列使用率达到70%告警 + platformIds: [2] # 可选配置,本配置优先级 > 所属线程池platformIds > 全局配置platforms + interval: 120 # 报警间隔(单位:s),默认120 - - type: liveness # 线程池活性 - enabled: true - threshold: 80 # 报警阈值,默认 70,意思是活性达到70%告警 + - type: liveness # 线程池活性 + enabled: true + threshold: 80 # 报警阈值,默认 70,意思是活性达到70%告警 - - type: reject # 触发任务拒绝告警 - enabled: true - threshold: 100 # 默认阈值10 + - type: reject # 触发任务拒绝告警 + enabled: true + threshold: 100 # 默认阈值10 - - type: run_timeout # 任务执行超时告警 - enabled: true - threshold: 100 # 默认阈值10 + - type: run_timeout # 任务执行超时告警 + enabled: true + threshold: 100 # 默认阈值10 - - type: queue_timeout # 任务排队超时告警 - enabled: true - threshold: 100 # 默认阈值10 + - type: queue_timeout # 任务排队超时告警 + enabled: true + threshold: 100 # 默认阈值10 diff --git a/test/test-core/src/test/java/org/dromara/dynamictp/test/core/parse/JsonConfigParserTest.java b/test/test-core/src/test/java/org/dromara/dynamictp/test/core/parse/JsonConfigParserTest.java index a9ede70d3..44da0521e 100644 --- a/test/test-core/src/test/java/org/dromara/dynamictp/test/core/parse/JsonConfigParserTest.java +++ b/test/test-core/src/test/java/org/dromara/dynamictp/test/core/parse/JsonConfigParserTest.java @@ -43,7 +43,7 @@ void testDoParse() throws IOException { JsonConfigParser parser = new JsonConfigParser(); Map result = parser.doParse(content); - Assertions.assertEquals("dtpExecutor1", result.get("spring.dynamic.tp.executors[0].threadPoolName").toString()); + Assertions.assertEquals("dtpExecutor1", result.get("dynamictp.executors[0].threadPoolName").toString()); } } diff --git a/test/test-core/src/test/java/org/dromara/dynamictp/test/core/parse/PropertiesConfigParserTest.java b/test/test-core/src/test/java/org/dromara/dynamictp/test/core/parse/PropertiesConfigParserTest.java index c10b1a7a5..3536d8c0f 100644 --- a/test/test-core/src/test/java/org/dromara/dynamictp/test/core/parse/PropertiesConfigParserTest.java +++ b/test/test-core/src/test/java/org/dromara/dynamictp/test/core/parse/PropertiesConfigParserTest.java @@ -43,7 +43,7 @@ void testDoParse() throws IOException { PropertiesConfigParser parser = new PropertiesConfigParser(); Map result = parser.doParse(content); - Assertions.assertEquals("dtpExecutor1", result.get("spring.dynamic.tp.executors[0].threadPoolName").toString()); + Assertions.assertEquals("dtpExecutor1", result.get("dynamictp.executors[0].threadPoolName").toString()); } } diff --git a/test/test-core/src/test/java/org/dromara/dynamictp/test/core/parse/YamlConfigParserTest.java b/test/test-core/src/test/java/org/dromara/dynamictp/test/core/parse/YamlConfigParserTest.java index 0ae6ee667..a67bddc1f 100644 --- a/test/test-core/src/test/java/org/dromara/dynamictp/test/core/parse/YamlConfigParserTest.java +++ b/test/test-core/src/test/java/org/dromara/dynamictp/test/core/parse/YamlConfigParserTest.java @@ -44,6 +44,6 @@ void testDoParse() throws FileNotFoundException { YamlConfigParser parser = new YamlConfigParser(); Map result = parser.doParse(content); - Assertions.assertEquals("dtpExecutor1", result.get("spring.dynamic.tp.executors[0].threadPoolName").toString()); + Assertions.assertEquals("dtpExecutor1", result.get("dynamictp.executors[0].threadPoolName").toString()); } } diff --git a/test/test-core/src/test/java/org/dromara/dynamictp/test/core/refresher/AbstractRefresherTest.java b/test/test-core/src/test/java/org/dromara/dynamictp/test/core/refresher/AbstractRefresherTest.java index 945889d00..c5b30be42 100644 --- a/test/test-core/src/test/java/org/dromara/dynamictp/test/core/refresher/AbstractRefresherTest.java +++ b/test/test-core/src/test/java/org/dromara/dynamictp/test/core/refresher/AbstractRefresherTest.java @@ -62,11 +62,10 @@ public void testRefresh(){ } private void mockConfigChange() { - String content = "spring:\n" + - " dynamic:\n" + - " tp:\n" + - " enabled: true\n" + - " env: newEnvValue"; + String content = + "dynamictp:\n" + + " enabled: true\n" + + " env: newEnvValue"; refresher.refresh(content, ConfigFileTypeEnum.YAML); } diff --git a/test/test-core/src/test/java/org/dromara/dynamictp/test/core/spring/DtpBaseBeanConfigurationTest.java b/test/test-core/src/test/java/org/dromara/dynamictp/test/core/spring/DtpBaseBeanConfigurationTest.java index 0124de69e..ba275799f 100644 --- a/test/test-core/src/test/java/org/dromara/dynamictp/test/core/spring/DtpBaseBeanConfigurationTest.java +++ b/test/test-core/src/test/java/org/dromara/dynamictp/test/core/spring/DtpBaseBeanConfigurationTest.java @@ -20,11 +20,13 @@ import org.dromara.dynamictp.core.DtpRegistry; import org.dromara.dynamictp.core.monitor.DtpMonitor; import org.dromara.dynamictp.core.support.DtpBannerPrinter; -import org.dromara.dynamictp.spring.*; +import org.dromara.dynamictp.spring.DtpBaseBeanConfiguration; +import org.dromara.dynamictp.spring.DtpPostProcessor; import org.dromara.dynamictp.spring.annotation.EnableDynamicTp; import org.dromara.dynamictp.spring.holder.SpringContextHolder; import org.dromara.dynamictp.spring.support.YamlPropertySourceFactory; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Autowired; @@ -42,9 +44,10 @@ @SpringBootTest(classes = DtpBaseBeanConfigurationTest.class) public class DtpBaseBeanConfigurationTest { + @Nested @SpringBootTest(classes = DtpBaseBeanConfigurationTest.class) @EnableDynamicTp - public static class EnableDynamicTpAnnotationTest { + class EnableDynamicTpAnnotationTest { @Autowired private ApplicationContext applicationContext; @@ -61,8 +64,9 @@ void test() { } + @Nested @SpringBootTest(classes = DtpBaseBeanConfigurationTest.class) - public static class DisableDynamicTpAnnotationTest { + class DisableDynamicTpAnnotationTest { @Autowired private ApplicationContext applicationContext; diff --git a/test/test-core/src/test/java/org/dromara/dynamictp/test/core/spring/DtpLifecycleSpringAdapterTest.java b/test/test-core/src/test/java/org/dromara/dynamictp/test/core/spring/DtpLifecycleSpringAdapterTest.java index a56bc3c5e..c0dd987ec 100644 --- a/test/test-core/src/test/java/org/dromara/dynamictp/test/core/spring/DtpLifecycleSpringAdapterTest.java +++ b/test/test-core/src/test/java/org/dromara/dynamictp/test/core/spring/DtpLifecycleSpringAdapterTest.java @@ -26,9 +26,9 @@ import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.ApplicationContext; /** * DtpLifecycleSpringAdapterTest related @@ -37,7 +37,7 @@ * @since 1.1.8 */ @SpringBootTest(classes = DtpLifecycleSpringAdapterTest.TestConfig.class) -public class DtpLifecycleSpringAdapterTest { +class DtpLifecycleSpringAdapterTest { @Autowired private ApplicationContext applicationContext; diff --git a/test/test-core/src/test/java/org/dromara/dynamictp/test/core/spring/PropertiesBinderTest.java b/test/test-core/src/test/java/org/dromara/dynamictp/test/core/spring/PropertiesBinderTest.java index 00748706b..12d4a90cf 100644 --- a/test/test-core/src/test/java/org/dromara/dynamictp/test/core/spring/PropertiesBinderTest.java +++ b/test/test-core/src/test/java/org/dromara/dynamictp/test/core/spring/PropertiesBinderTest.java @@ -57,25 +57,25 @@ class PropertiesBinderTest { void testBindDtpPropertiesWithMap() throws Exception { try { Map properties = Maps.newHashMap(); - properties.put("spring.dynamic.tp.enabled", false); - properties.put("spring.dynamic.tp.collectorTypes", Lists.newArrayList("LOGGING")); - properties.put("spring.dynamic.tp.executors[0].threadPoolName", "test_dtp"); - properties.put("spring.dynamic.tp.executors[1].threadPoolName", "test_dtp1"); - properties.put("spring.dynamic.tp.executors[0].executorType", "common"); - properties.put("spring.dynamic.tp.globalExecutorProps.executorType", "eager"); + properties.put("dynamictp.enabled", false); + properties.put("dynamictp.collectorTypes", Lists.newArrayList("LOGGING")); + properties.put("dynamictp.executors[0].threadPoolName", "test_dtp"); + properties.put("dynamictp.executors[1].threadPoolName", "test_dtp1"); + properties.put("dynamictp.executors[0].executorType", "common"); + properties.put("dynamictp.globalExecutorProps.executorType", "eager"); DtpProperties dtpProperties = DtpProperties.getInstance(); System.out.println("Collector Types before binding: " + dtpProperties.getCollectorTypes()); BinderHelper.bindDtpProperties(properties, dtpProperties); System.out.println("Collector Types after binding: " + dtpProperties.getCollectorTypes()); - Assertions.assertEquals(properties.get("spring.dynamic.tp.executors[0].threadPoolName"), + Assertions.assertEquals(properties.get("dynamictp.executors[0].threadPoolName"), dtpProperties.getExecutors().get(0).getThreadPoolName()); - Assertions.assertIterableEquals((List) properties.get("spring.dynamic.tp.collectorTypes"), + Assertions.assertIterableEquals((List) properties.get("dynamictp.collectorTypes"), dtpProperties.getCollectorTypes()); Assertions.assertEquals("common", dtpProperties.getExecutors().get(0).getExecutorType()); - Assertions.assertEquals(properties.get("spring.dynamic.tp.globalExecutorProps.executorType"), + Assertions.assertEquals(properties.get("dynamictp.globalExecutorProps.executorType"), dtpProperties.getExecutors().get(1).getExecutorType()); } catch (Exception e) { @@ -87,9 +87,9 @@ void testBindDtpPropertiesWithMap() throws Exception { void testBindDtpPropertiesWithEnvironment() { DtpProperties dtpProperties = DtpProperties.getInstance(); BinderHelper.bindDtpProperties(environment, dtpProperties); - String threadPoolName = environment.getProperty("spring.dynamic.tp.executors[0].threadPoolName"); + String threadPoolName = environment.getProperty("dynamictp.executors[0].threadPoolName"); Assertions.assertEquals(threadPoolName, dtpProperties.getExecutors().get(0).getThreadPoolName()); - String executorType = environment.getProperty("spring.dynamic.tp.globalExecutorProps.executorType"); + String executorType = environment.getProperty("dynamictp.globalExecutorProps.executorType"); Assertions.assertEquals(executorType, dtpProperties.getExecutors().get(1).getExecutorType()); } diff --git a/test/test-core/src/test/resources/demo-dtp-dev.properties b/test/test-core/src/test/resources/demo-dtp-dev.properties index d4ce5a9db..a92c700b4 100644 --- a/test/test-core/src/test/resources/demo-dtp-dev.properties +++ b/test/test-core/src/test/resources/demo-dtp-dev.properties @@ -1,72 +1,72 @@ -spring.dynamic.tp.enabled=true -spring.dynamic.tp.enabledBanner=true -spring.dynamic.tp.enabledCollect=true -spring.dynamic.tp.collectorTypes=micrometer,logging -spring.dynamic.tp.logPath=/home/logs -spring.dynamic.tp.monitorInterval=5 -spring.dynamic.tp.platforms[0].platform=wechat -spring.dynamic.tp.platforms[0].urlKey=3a7500-1287-4bd-a798-c5c3d8b69c -spring.dynamic.tp.platforms[0].receivers=test1,test2 -spring.dynamic.tp.platforms[1].platform=ding -spring.dynamic.tp.platforms[1].urlKey=f80dad441fcd655438f4a08dcd6a -spring.dynamic.tp.platforms[1].secret=SECb5441fa6f375d5b9d21 -spring.dynamic.tp.platforms[1].receivers=15810119805 -spring.dynamic.tp.platforms[2].platform=lark -spring.dynamic.tp.platforms[2].urlKey=0d944ae7-b24a-40 -spring.dynamic.tp.platforms[2].receivers=test1,test2 -spring.dynamic.tp.tomcatTp.corePoolSize=100 -spring.dynamic.tp.tomcatTp.maximumPoolSize=400 -spring.dynamic.tp.tomcatTp.keepAliveTime=60 -spring.dynamic.tp.jettyTp.corePoolSize=100 -spring.dynamic.tp.jettyTp.maximumPoolSize=400 -spring.dynamic.tp.undertowTp.corePoolSize=100 -spring.dynamic.tp.undertowTp.maximumPoolSize=400 -spring.dynamic.tp.undertowTp.keepAliveTime=60 -spring.dynamic.tp.hystrixTp[0].threadPoolName=hystrix1 -spring.dynamic.tp.hystrixTp[0].corePoolSize=100 -spring.dynamic.tp.hystrixTp[0].maximumPoolSize=400 -spring.dynamic.tp.hystrixTp[0].keepAliveTime=60 -spring.dynamic.tp.dubboTp[0].threadPoolName=dubboTp#20880 -spring.dynamic.tp.dubboTp[0].corePoolSize=100 -spring.dynamic.tp.dubboTp[0].maximumPoolSize=400 -spring.dynamic.tp.dubboTp[0].keepAliveTime=60 -spring.dynamic.tp.rocketMqTp[0].threadPoolName=group1#topic1 -spring.dynamic.tp.rocketMqTp[0].corePoolSize=200 -spring.dynamic.tp.rocketMqTp[0].maximumPoolSize=400 -spring.dynamic.tp.rocketMqTp[0].keepAliveTime=60 -spring.dynamic.tp.executors[0].threadPoolName=dtpExecutor1 -spring.dynamic.tp.executors[0].executorType=common -spring.dynamic.tp.executors[0].corePoolSize=6 -spring.dynamic.tp.executors[0].maximumPoolSize=8 -spring.dynamic.tp.executors[0].queueCapacity=200 -spring.dynamic.tp.executors[0].queueType=VariableLinkedBlockingQueue -spring.dynamic.tp.executors[0].rejectedHandlerType=CallerRunsPolicy -spring.dynamic.tp.executors[0].keepAliveTime=50 -spring.dynamic.tp.executors[0].allowCoreThreadTimeOut=false -spring.dynamic.tp.executors[0].threadNamePrefix=test -spring.dynamic.tp.executors[0].waitForTasksToCompleteOnShutdown=false -spring.dynamic.tp.executors[0].awaitTerminationSeconds=5 -spring.dynamic.tp.executors[0].preStartAllCoreThreads=false -spring.dynamic.tp.executors[0].runTimeout=200 -spring.dynamic.tp.executors[0].queueTimeout=100 -spring.dynamic.tp.executors[0].taskWrapperNames[0]=ttl -spring.dynamic.tp.executors[0].notifyItems[0].type=capacity -spring.dynamic.tp.executors[0].notifyItems[0].enabled=true -spring.dynamic.tp.executors[0].notifyItems[0].threshold=80 -spring.dynamic.tp.executors[0].notifyItems[0].platforms[0]=ding -spring.dynamic.tp.executors[0].notifyItems[0].platforms[1]=wechat -spring.dynamic.tp.executors[0].notifyItems[0].interval=120 -spring.dynamic.tp.executors[0].notifyItems[1].type=change -spring.dynamic.tp.executors[0].notifyItems[1].enabled=true -spring.dynamic.tp.executors[0].notifyItems[2].type=liveness -spring.dynamic.tp.executors[0].notifyItems[2].enabled=true -spring.dynamic.tp.executors[0].notifyItems[2].threshold=80 -spring.dynamic.tp.executors[0].notifyItems[3].type=reject -spring.dynamic.tp.executors[0].notifyItems[3].enabled=true -spring.dynamic.tp.executors[0].notifyItems[3].threshold=1 -spring.dynamic.tp.executors[0].notifyItems[4].type=run_timeout -spring.dynamic.tp.executors[0].notifyItems[4].enabled=true -spring.dynamic.tp.executors[0].notifyItems[4].threshold=1 -spring.dynamic.tp.executors[0].notifyItems[5].type=queue_timeout -spring.dynamic.tp.executors[0].notifyItems[5].enabled=true -spring.dynamic.tp.executors[0].notifyItems[5].threshold=1 +dynamictp.enabled=true +dynamictp.enabledBanner=true +dynamictp.enabledCollect=true +dynamictp.collectorTypes=micrometer,logging +dynamictp.logPath=/home/logs +dynamictp.monitorInterval=5 +dynamictp.platforms[0].platform=wechat +dynamictp.platforms[0].urlKey=3a7500-1287-4bd-a798-c5c3d8b69c +dynamictp.platforms[0].receivers=test1,test2 +dynamictp.platforms[1].platform=ding +dynamictp.platforms[1].urlKey=f80dad441fcd655438f4a08dcd6a +dynamictp.platforms[1].secret=SECb5441fa6f375d5b9d21 +dynamictp.platforms[1].receivers=15810119805 +dynamictp.platforms[2].platform=lark +dynamictp.platforms[2].urlKey=0d944ae7-b24a-40 +dynamictp.platforms[2].receivers=test1,test2 +dynamictp.tomcatTp.corePoolSize=100 +dynamictp.tomcatTp.maximumPoolSize=400 +dynamictp.tomcatTp.keepAliveTime=60 +dynamictp.jettyTp.corePoolSize=100 +dynamictp.jettyTp.maximumPoolSize=400 +dynamictp.undertowTp.corePoolSize=100 +dynamictp.undertowTp.maximumPoolSize=400 +dynamictp.undertowTp.keepAliveTime=60 +dynamictp.hystrixTp[0].threadPoolName=hystrix1 +dynamictp.hystrixTp[0].corePoolSize=100 +dynamictp.hystrixTp[0].maximumPoolSize=400 +dynamictp.hystrixTp[0].keepAliveTime=60 +dynamictp.dubboTp[0].threadPoolName=dubboTp#20880 +dynamictp.dubboTp[0].corePoolSize=100 +dynamictp.dubboTp[0].maximumPoolSize=400 +dynamictp.dubboTp[0].keepAliveTime=60 +dynamictp.rocketMqTp[0].threadPoolName=group1#topic1 +dynamictp.rocketMqTp[0].corePoolSize=200 +dynamictp.rocketMqTp[0].maximumPoolSize=400 +dynamictp.rocketMqTp[0].keepAliveTime=60 +dynamictp.executors[0].threadPoolName=dtpExecutor1 +dynamictp.executors[0].executorType=common +dynamictp.executors[0].corePoolSize=6 +dynamictp.executors[0].maximumPoolSize=8 +dynamictp.executors[0].queueCapacity=200 +dynamictp.executors[0].queueType=VariableLinkedBlockingQueue +dynamictp.executors[0].rejectedHandlerType=CallerRunsPolicy +dynamictp.executors[0].keepAliveTime=50 +dynamictp.executors[0].allowCoreThreadTimeOut=false +dynamictp.executors[0].threadNamePrefix=test +dynamictp.executors[0].waitForTasksToCompleteOnShutdown=false +dynamictp.executors[0].awaitTerminationSeconds=5 +dynamictp.executors[0].preStartAllCoreThreads=false +dynamictp.executors[0].runTimeout=200 +dynamictp.executors[0].queueTimeout=100 +dynamictp.executors[0].taskWrapperNames[0]=ttl +dynamictp.executors[0].notifyItems[0].type=capacity +dynamictp.executors[0].notifyItems[0].enabled=true +dynamictp.executors[0].notifyItems[0].threshold=80 +dynamictp.executors[0].notifyItems[0].platforms[0]=ding +dynamictp.executors[0].notifyItems[0].platforms[1]=wechat +dynamictp.executors[0].notifyItems[0].interval=120 +dynamictp.executors[0].notifyItems[1].type=change +dynamictp.executors[0].notifyItems[1].enabled=true +dynamictp.executors[0].notifyItems[2].type=liveness +dynamictp.executors[0].notifyItems[2].enabled=true +dynamictp.executors[0].notifyItems[2].threshold=80 +dynamictp.executors[0].notifyItems[3].type=reject +dynamictp.executors[0].notifyItems[3].enabled=true +dynamictp.executors[0].notifyItems[3].threshold=1 +dynamictp.executors[0].notifyItems[4].type=run_timeout +dynamictp.executors[0].notifyItems[4].enabled=true +dynamictp.executors[0].notifyItems[4].threshold=1 +dynamictp.executors[0].notifyItems[5].type=queue_timeout +dynamictp.executors[0].notifyItems[5].enabled=true +dynamictp.executors[0].notifyItems[5].threshold=1 diff --git a/test/test-core/src/test/resources/demo-dtp-dev.yml b/test/test-core/src/test/resources/demo-dtp-dev.yml index 801645617..8ca6254cd 100644 --- a/test/test-core/src/test/resources/demo-dtp-dev.yml +++ b/test/test-core/src/test/resources/demo-dtp-dev.yml @@ -1,121 +1,119 @@ # 动态线程池配置文件,建议单独开一个文件放到配置中心,字段详解看readme介绍 -spring: - dynamic: - tp: - enabled: true - enabledBanner: true # 是否开启banner打印,默认true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs- - monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - tomcatTp: # tomcat web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - jettyTp: # jetty web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - undertowTp: # undertow web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - hystrixTp: # hystrix 线程池配置 - - threadPoolName: hystrix1 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - dubboTp: # dubbo 线程池配置 - - threadPoolName: dubboTp#20880 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - rocketMqTp: # rocketmq 线程池配置 - - threadPoolName: group1#topic1 - corePoolSize: 200 - maximumPoolSize: 400 - keepAliveTime: 60 - - threadPoolName: group2#topic2 - maximumPoolSize: 200 - keepAliveTime: 60 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) - - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 82 # 报警阈值 - platforms: [ ding,wechat ] # 可选配置,不配置默认拿上层platforms配置的所以平台 - interval: 120 # 报警间隔(单位:s) +dynamictp: + enabled: true + enabledBanner: true # 是否开启banner打印,默认true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs- + monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + tomcatTp: # tomcat web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + jettyTp: # jetty web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + undertowTp: # undertow web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + hystrixTp: # hystrix 线程池配置 + - threadPoolName: hystrix1 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + dubboTp: # dubbo 线程池配置 + - threadPoolName: dubboTp#20880 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + rocketMqTp: # rocketmq 线程池配置 + - threadPoolName: group1#topic1 + corePoolSize: 200 + maximumPoolSize: 400 + keepAliveTime: 60 + - threadPoolName: group2#topic2 + maximumPoolSize: 200 + keepAliveTime: 60 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) + - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 + enabled: true + threshold: 82 # 报警阈值 + platforms: [ ding,wechat ] # 可选配置,不配置默认拿上层platforms配置的所以平台 + interval: 120 # 报警间隔(单位:s) - globalExecutorProps: - corePoolSize: 1 - waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 - awaitTerminationSeconds: 5 # 单位(s) - preStartAllCoreThreads: false # 是否预热所有核心线程,默认false - runTimeout: 201 # 任务执行超时阈值,目前只做告警用,单位(ms) - queueTimeout: 101 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) - taskWrapperNames: [ "ttl" ] # 任务包装器名称,集成TaskWrapper接口 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) - - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 81 # 报警阈值 - platforms: [ ding,wechat ] # 可选配置,不配置默认拿上层platforms配置的所以平台 - interval: 120 # 报警间隔(单位:s) - - type: change - enabled: true - - type: liveness - enabled: true - threshold: 80 - - type: reject - enabled: true - threshold: 1 - - type: queue_timeout - enabled: true - threshold: 1 - executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 - - threadPoolName: dtpExecutor1 - executorType: common # 线程池类型common、eager:适用于io密集型 - corePoolSize: 6 - maximumPoolSize: 8 - queueCapacity: 200 - queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 - rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 - keepAliveTime: 50 - allowCoreThreadTimeOut: false # 是否允许核心线程池超时 - threadNamePrefix: test # 线程名前缀 - waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 - awaitTerminationSeconds: 5 # 单位(s) - preStartAllCoreThreads: false # 是否预热所有核心线程,默认false - runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) - queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) - taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) - - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 80 # 报警阈值 - platforms: [ding,wechat] # 可选配置,不配置默认拿上层platforms配置的所以平台 - interval: 120 # 报警间隔(单位:s) - - type: change - enabled: true - - type: liveness - enabled: true - threshold: 80 - - type: reject - enabled: true - threshold: 1 - - type: run_timeout - enabled: true - threshold: 1 - - type: queue_timeout - enabled: true - threshold: 1 - - threadPoolName: dtpExecutor2 - maximumPoolSize: 18 \ No newline at end of file + globalExecutorProps: + corePoolSize: 1 + waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 + awaitTerminationSeconds: 5 # 单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 201 # 任务执行超时阈值,目前只做告警用,单位(ms) + queueTimeout: 101 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) + taskWrapperNames: [ "ttl" ] # 任务包装器名称,集成TaskWrapper接口 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) + - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 + enabled: true + threshold: 81 # 报警阈值 + platforms: [ ding,wechat ] # 可选配置,不配置默认拿上层platforms配置的所以平台 + interval: 120 # 报警间隔(单位:s) + - type: change + enabled: true + - type: liveness + enabled: true + threshold: 80 + - type: reject + enabled: true + threshold: 1 + - type: queue_timeout + enabled: true + threshold: 1 + executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 + - threadPoolName: dtpExecutor1 + executorType: common # 线程池类型common、eager:适用于io密集型 + corePoolSize: 6 + maximumPoolSize: 8 + queueCapacity: 200 + queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 + rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 + keepAliveTime: 50 + allowCoreThreadTimeOut: false # 是否允许核心线程池超时 + threadNamePrefix: test # 线程名前缀 + waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 + awaitTerminationSeconds: 5 # 单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) + queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) + taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) + - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 + enabled: true + threshold: 80 # 报警阈值 + platforms: [ding,wechat] # 可选配置,不配置默认拿上层platforms配置的所以平台 + interval: 120 # 报警间隔(单位:s) + - type: change + enabled: true + - type: liveness + enabled: true + threshold: 80 + - type: reject + enabled: true + threshold: 1 + - type: run_timeout + enabled: true + threshold: 1 + - type: queue_timeout + enabled: true + threshold: 1 + - threadPoolName: dtpExecutor2 + maximumPoolSize: 18 \ No newline at end of file diff --git a/test/test-core/src/test/resources/dynamic-tp-demo.yml b/test/test-core/src/test/resources/dynamic-tp-demo.yml index 4596e712b..fb4a0ef6c 100644 --- a/test/test-core/src/test/resources/dynamic-tp-demo.yml +++ b/test/test-core/src/test/resources/dynamic-tp-demo.yml @@ -1,91 +1,89 @@ # 动态线程池配置文件,建议单独开一个文件放到配置中心,字段详解看readme介绍 -spring: - dynamic: - tp: - enabled: true - enabledBanner: true # 是否开启banner打印,默认true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: jmx,micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs - monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s - configType: yml # 配置文件类型 - executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 - - threadPoolName: testRunTimeoutDtpExecutor - executorType: common # 线程池类型common、eager:适用于io密集型 - corePoolSize: 1 - maximumPoolSize: 1 - queueCapacity: 500 - queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 - rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 - keepAliveTime: 50 - allowCoreThreadTimeOut: false # 是否允许核心线程池超时 - threadNamePrefix: test # 线程名前缀 - waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 - awaitTerminationSeconds: 5 # 单位(s) - preStartAllCoreThreads: false # 是否预热所有核心线程,默认false - runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) - queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) - taskWrapperNames: [ "ttl" ] # 任务包装器名称,集成TaskWrapper接口 - - threadPoolName: testQueueTimeoutDtpExecutor - executorType: common # 线程池类型common、eager:适用于io密集型 - corePoolSize: 1 - maximumPoolSize: 1 - queueCapacity: 500 - queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 - rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 - keepAliveTime: 50 - allowCoreThreadTimeOut: false # 是否允许核心线程池超时 - threadNamePrefix: test # 线程名前缀 - waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 - awaitTerminationSeconds: 5 # 单位(s) - preStartAllCoreThreads: false # 是否预热所有核心线程,默认false - runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) - queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) - taskWrapperNames: [ "ttl" ] # 任务包装器名称,集成TaskWrapper接口 - - threadPoolName: testRejectedQueueTimeoutCancelDtpExecutor - executorType: common # 线程池类型common、eager:适用于io密集型 - corePoolSize: 1 - maximumPoolSize: 1 - queueCapacity: 50 - queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 - rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 - keepAliveTime: 50 - allowCoreThreadTimeOut: false # 是否允许核心线程池超时 - threadNamePrefix: test # 线程名前缀 - waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 - awaitTerminationSeconds: 5 # 单位(s) - preStartAllCoreThreads: false # 是否预热所有核心线程,默认false - runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) - queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) - taskWrapperNames: [ "ttl" ] # 任务包装器名称,集成TaskWrapper接口 - - threadPoolName: eagerDtpThreadPoolExecutor - executorType: eager # 线程池类型common、eager:适用于io密集型 - corePoolSize: 1 - maximumPoolSize: 5 - queueCapacity: 5000 - queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 - rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 - keepAliveTime: 50 - allowCoreThreadTimeOut: false # 是否允许核心线程池超时 - threadNamePrefix: eagerDtp # 线程名前缀 - waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 - awaitTerminationSeconds: 5 # 单位(s) - preStartAllCoreThreads: false # 是否预热所有核心线程,默认false - runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) - queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) - taskWrapperNames: [ "ttl" ] # 任务包装器名称,集成TaskWrapper接口 - - threadPoolName: priorityDtpThreadPoolExecutor - executorType: priority # 线程池类型common、eager:适用于io密集型 - corePoolSize: 1 - maximumPoolSize: 1 - queueCapacity: 5000 - rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 - keepAliveTime: 50 - allowCoreThreadTimeOut: false # 是否允许核心线程池超时 - threadNamePrefix: eagerDtp # 线程名前缀 - waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 - awaitTerminationSeconds: 5 # 单位(s) - preStartAllCoreThreads: false # 是否预热所有核心线程,默认false - runTimeout: 10000 # 任务执行超时阈值,目前只做告警用,单位(ms) - queueTimeout: 10000 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) - taskWrapperNames: [ "ttl" ] # 任务包装器名称,集成TaskWrapper接口 \ No newline at end of file +dynamictp: + enabled: true + enabledBanner: true # 是否开启banner打印,默认true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: jmx,micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs + monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s + configType: yml # 配置文件类型 + executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 + - threadPoolName: testRunTimeoutDtpExecutor + executorType: common # 线程池类型common、eager:适用于io密集型 + corePoolSize: 1 + maximumPoolSize: 1 + queueCapacity: 500 + queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 + rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 + keepAliveTime: 50 + allowCoreThreadTimeOut: false # 是否允许核心线程池超时 + threadNamePrefix: test # 线程名前缀 + waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 + awaitTerminationSeconds: 5 # 单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) + queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) + taskWrapperNames: [ "ttl" ] # 任务包装器名称,集成TaskWrapper接口 + - threadPoolName: testQueueTimeoutDtpExecutor + executorType: common # 线程池类型common、eager:适用于io密集型 + corePoolSize: 1 + maximumPoolSize: 1 + queueCapacity: 500 + queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 + rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 + keepAliveTime: 50 + allowCoreThreadTimeOut: false # 是否允许核心线程池超时 + threadNamePrefix: test # 线程名前缀 + waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 + awaitTerminationSeconds: 5 # 单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) + queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) + taskWrapperNames: [ "ttl" ] # 任务包装器名称,集成TaskWrapper接口 + - threadPoolName: testRejectedQueueTimeoutCancelDtpExecutor + executorType: common # 线程池类型common、eager:适用于io密集型 + corePoolSize: 1 + maximumPoolSize: 1 + queueCapacity: 50 + queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 + rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 + keepAliveTime: 50 + allowCoreThreadTimeOut: false # 是否允许核心线程池超时 + threadNamePrefix: test # 线程名前缀 + waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 + awaitTerminationSeconds: 5 # 单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) + queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) + taskWrapperNames: [ "ttl" ] # 任务包装器名称,集成TaskWrapper接口 + - threadPoolName: eagerDtpThreadPoolExecutor + executorType: eager # 线程池类型common、eager:适用于io密集型 + corePoolSize: 1 + maximumPoolSize: 5 + queueCapacity: 5000 + queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 + rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 + keepAliveTime: 50 + allowCoreThreadTimeOut: false # 是否允许核心线程池超时 + threadNamePrefix: eagerDtp # 线程名前缀 + waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 + awaitTerminationSeconds: 5 # 单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) + queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) + taskWrapperNames: [ "ttl" ] # 任务包装器名称,集成TaskWrapper接口 + - threadPoolName: priorityDtpThreadPoolExecutor + executorType: priority # 线程池类型common、eager:适用于io密集型 + corePoolSize: 1 + maximumPoolSize: 1 + queueCapacity: 5000 + rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 + keepAliveTime: 50 + allowCoreThreadTimeOut: false # 是否允许核心线程池超时 + threadNamePrefix: eagerDtp # 线程名前缀 + waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 + awaitTerminationSeconds: 5 # 单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 10000 # 任务执行超时阈值,目前只做告警用,单位(ms) + queueTimeout: 10000 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) + taskWrapperNames: [ "ttl" ] # 任务包装器名称,集成TaskWrapper接口 \ No newline at end of file diff --git a/test/test-core/src/test/resources/dynamic-tp-nacos-demo-dtp-dev.yml b/test/test-core/src/test/resources/dynamic-tp-nacos-demo-dtp-dev.yml index 057fc2628..5358276cd 100644 --- a/test/test-core/src/test/resources/dynamic-tp-nacos-demo-dtp-dev.yml +++ b/test/test-core/src/test/resources/dynamic-tp-nacos-demo-dtp-dev.yml @@ -1,190 +1,188 @@ # 动态线程池配置文件,建议单独开一个文件放到配置中心,字段详解看readme介绍 -spring: - dynamic: - tp: - enabled: true - enabledBanner: true # 是否开启banner打印,默认true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs - monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s - nacos: # nacos配置,不配置有默认值(规则name-dev.yml这样),cloud应用不需要配置 - dataId: dynamic-tp-nacos-demo-dev.yml - group: DEFAULT_GROUP - configType: yml # 配置文件类型 - platforms: # 通知报警平台配置 - - platform: wechat - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - - platform: wechat - platformId: my-1 - urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 - receivers: test1,test2 # 接受人企微名称 - - platform: ding - platformId: my-2 - urlKey: f80dad441fcd655438f4a08dcd6a # 替换 - secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 - receivers: 15810119805 # 钉钉账号手机号 - - platform: lark - platformId: my-3 - urlKey: 0d944ae7-b24a-40 # 替换 - receivers: test1,test2 # 接受人飞书名称/openid - tomcatTp: # tomcat web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - jettyTp: # jetty web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - undertowTp: # undertow web server线程池配置 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - hystrixTp: # hystrix 线程池配置 - - threadPoolName: hystrix1 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - dubboTp: # dubbo 线程池配置 - - threadPoolName: dubboTp#20880 - corePoolSize: 100 - maximumPoolSize: 400 - keepAliveTime: 60 - rocketMqTp: # rocketmq 线程池配置 - - threadPoolName: group1#topic1 - corePoolSize: 200 - maximumPoolSize: 400 - keepAliveTime: 60 - executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 - - threadPoolName: dtpExecutor1 - executorType: common # 线程池类型common、eager:适用于io密集型 - corePoolSize: 1 - maximumPoolSize: 1 - queueCapacity: 5 - queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 - rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 - keepAliveTime: 50 - allowCoreThreadTimeOut: false # 是否允许核心线程池超时 - threadNamePrefix: test # 线程名前缀 - waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 - awaitTerminationSeconds: 5 # 单位(s) - preStartAllCoreThreads: false # 是否预热所有核心线程,默认false - runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) - queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) - taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) - - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 80 # 报警阈值 - platforms: [ding,wechat] # 可选配置,不配置默认拿上层platforms配置的所以平台 - interval: 120 # 报警间隔(单位:s) - - type: change - enabled: true - - type: liveness - enabled: true - threshold: 80 - - type: reject - enabled: true - threshold: 1 - - type: run_timeout - enabled: true - threshold: 1 - - type: queue_timeout - enabled: true - threshold: 1 - - threadPoolName: orderedDtpExecutor - executorType: ordered - corePoolSize: 4 - maximumPoolSize: 6 - queueCapacity: 2000 - queueType: VariableLinkedBlockingQueue - rejectedHandlerType: CallerRunsPolicy - keepAliveTime: 3 - allowCoreThreadTimeOut: false - threadNamePrefix: test - taskWrapperNames: ["ttl", "mdc"] # 任务包装器名称,集成TaskWrapper接口 - - threadPoolName: dtpExecutor12 - executorType: scheduled # 线程池类型common、eager:适用于io密集型 - corePoolSize: 6 - maximumPoolSize: 8 - queueCapacity: 200 - queueType: DelayQueue # 任务队列,查看源码QueueTypeEnum枚举类 - rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 - keepAliveTime: 50 - allowCoreThreadTimeOut: false # 是否允许核心线程池超时 - threadNamePrefix: test # 线程名前缀 - waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 - awaitTerminationSeconds: 5 # 单位(s) - preStartAllCoreThreads: false # 是否预热所有核心线程,默认false - runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) - queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) - taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) - - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 80 # 报警阈值 - platformIds: [ my-1, my-2 ] # 可选配置,不配置默认拿上层platforms配置的所以平台 - interval: 120 # 报警间隔(单位:s) - - type: change - enabled: true - - type: liveness - enabled: true - threshold: 80 - - type: reject - enabled: true - threshold: 1 - - type: run_timeout - enabled: true - threshold: 1 - - type: queue_timeout - enabled: true - threshold: 1 - - threadPoolName: dtpExecutor13 # 测试当核心数为0时,ScheduledThreadPoolExecutor占用CPU问题 - executorType: scheduled # 线程池类型common、eager:适用于io密集型 - corePoolSize: 0 # 0时,ScheduledThreadPoolExecutor占用CPU问题 - maximumPoolSize: 100 - queueCapacity: 200 - queueType: DelayQueue # 任务队列,查看源码QueueTypeEnum枚举类 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) - - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 0 # 报警阈值 - platformIds: [ my-1, my-2 ] # 可选配置,不配置默认拿上层platforms配置的所以平台 - interval: 1 # 报警间隔(单位:s) - - type: change - enabled: true - - type: liveness - enabled: true - threshold: 80 - - type: reject - enabled: true - threshold: 1 - - type: run_timeout - enabled: true - threshold: 1 - - type: queue_timeout - enabled: true - threshold: 1 - - threadPoolName: dtpExecutor14 # 测试当核心数为0时,ScheduledThreadPoolExecutor占用CPU问题 - executorType: scheduled # 线程池类型common、eager:适用于io密集型 - corePoolSize: 0 # 0时,ScheduledThreadPoolExecutor占用CPU问题 - maximumPoolSize: 100 - queueCapacity: 200 - queueType: DelayQueue # 任务队列,查看源码QueueTypeEnum枚举类 - platformIds: [ my-1, my-2 ] # 可选配置,不配置默认拿上层platforms配置的所以平台 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) - - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 0 # 报警阈值 - platformIds: [ my-1, my-3 ] # 可选配置,不配置默认拿上层platforms配置的所以平台 +dynamictp: + enabled: true + enabledBanner: true # 是否开启banner打印,默认true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: micrometer,logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + logPath: /home/logs # 监控日志数据路径,默认 ${user.home}/logs + monitorInterval: 5 # 监控时间间隔(报警判断、指标采集),默认5s + nacos: # nacos配置,不配置有默认值(规则name-dev.yml这样),cloud应用不需要配置 + dataId: dynamic-tp-nacos-demo-dev.yml + group: DEFAULT_GROUP + configType: yml # 配置文件类型 + platforms: # 通知报警平台配置 + - platform: wechat + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + - platform: wechat + platformId: my-1 + urlKey: 3a7500-1287-4bd-a798-c5c3d8b69c # 替换 + receivers: test1,test2 # 接受人企微名称 + - platform: ding + platformId: my-2 + urlKey: f80dad441fcd655438f4a08dcd6a # 替换 + secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 + receivers: 15810119805 # 钉钉账号手机号 + - platform: lark + platformId: my-3 + urlKey: 0d944ae7-b24a-40 # 替换 + receivers: test1,test2 # 接受人飞书名称/openid + tomcatTp: # tomcat web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + jettyTp: # jetty web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + undertowTp: # undertow web server线程池配置 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + hystrixTp: # hystrix 线程池配置 + - threadPoolName: hystrix1 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + dubboTp: # dubbo 线程池配置 + - threadPoolName: dubboTp#20880 + corePoolSize: 100 + maximumPoolSize: 400 + keepAliveTime: 60 + rocketMqTp: # rocketmq 线程池配置 + - threadPoolName: group1#topic1 + corePoolSize: 200 + maximumPoolSize: 400 + keepAliveTime: 60 + executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 + - threadPoolName: dtpExecutor1 + executorType: common # 线程池类型common、eager:适用于io密集型 + corePoolSize: 1 + maximumPoolSize: 1 + queueCapacity: 5 + queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 + rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 + keepAliveTime: 50 + allowCoreThreadTimeOut: false # 是否允许核心线程池超时 + threadNamePrefix: test # 线程名前缀 + waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 + awaitTerminationSeconds: 5 # 单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) + queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) + taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) + - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 + enabled: true + threshold: 80 # 报警阈值 + platforms: [ding,wechat] # 可选配置,不配置默认拿上层platforms配置的所以平台 + interval: 120 # 报警间隔(单位:s) + - type: change + enabled: true + - type: liveness + enabled: true + threshold: 80 + - type: reject + enabled: true + threshold: 1 + - type: run_timeout + enabled: true + threshold: 1 + - type: queue_timeout + enabled: true + threshold: 1 + - threadPoolName: orderedDtpExecutor + executorType: ordered + corePoolSize: 4 + maximumPoolSize: 6 + queueCapacity: 2000 + queueType: VariableLinkedBlockingQueue + rejectedHandlerType: CallerRunsPolicy + keepAliveTime: 3 + allowCoreThreadTimeOut: false + threadNamePrefix: test + taskWrapperNames: ["ttl", "mdc"] # 任务包装器名称,集成TaskWrapper接口 + - threadPoolName: dtpExecutor12 + executorType: scheduled # 线程池类型common、eager:适用于io密集型 + corePoolSize: 6 + maximumPoolSize: 8 + queueCapacity: 200 + queueType: DelayQueue # 任务队列,查看源码QueueTypeEnum枚举类 + rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 + keepAliveTime: 50 + allowCoreThreadTimeOut: false # 是否允许核心线程池超时 + threadNamePrefix: test # 线程名前缀 + waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 + awaitTerminationSeconds: 5 # 单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) + queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) + taskWrapperNames: ["ttl"] # 任务包装器名称,集成TaskWrapper接口 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) + - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 + enabled: true + threshold: 80 # 报警阈值 + platformIds: [ my-1, my-2 ] # 可选配置,不配置默认拿上层platforms配置的所以平台 + interval: 120 # 报警间隔(单位:s) + - type: change + enabled: true + - type: liveness + enabled: true + threshold: 80 + - type: reject + enabled: true + threshold: 1 + - type: run_timeout + enabled: true + threshold: 1 + - type: queue_timeout + enabled: true + threshold: 1 + - threadPoolName: dtpExecutor13 # 测试当核心数为0时,ScheduledThreadPoolExecutor占用CPU问题 + executorType: scheduled # 线程池类型common、eager:适用于io密集型 + corePoolSize: 0 # 0时,ScheduledThreadPoolExecutor占用CPU问题 + maximumPoolSize: 100 + queueCapacity: 200 + queueType: DelayQueue # 任务队列,查看源码QueueTypeEnum枚举类 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) + - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 + enabled: true + threshold: 0 # 报警阈值 + platformIds: [ my-1, my-2 ] # 可选配置,不配置默认拿上层platforms配置的所以平台 + interval: 1 # 报警间隔(单位:s) + - type: change + enabled: true + - type: liveness + enabled: true + threshold: 80 + - type: reject + enabled: true + threshold: 1 + - type: run_timeout + enabled: true + threshold: 1 + - type: queue_timeout + enabled: true + threshold: 1 + - threadPoolName: dtpExecutor14 # 测试当核心数为0时,ScheduledThreadPoolExecutor占用CPU问题 + executorType: scheduled # 线程池类型common、eager:适用于io密集型 + corePoolSize: 0 # 0时,ScheduledThreadPoolExecutor占用CPU问题 + maximumPoolSize: 100 + queueCapacity: 200 + queueType: DelayQueue # 任务队列,查看源码QueueTypeEnum枚举类 + platformIds: [ my-1, my-2 ] # 可选配置,不配置默认拿上层platforms配置的所以平台 + notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) + - type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 + enabled: true + threshold: 0 # 报警阈值 + platformIds: [ my-1, my-3 ] # 可选配置,不配置默认拿上层platforms配置的所以平台 # platforms: [wechat, ding] # 可选配置,不配置默认拿上层platforms配置的所以平台 - interval: 1 # 报警间隔(单位:s) - - type: change - enabled: true \ No newline at end of file + interval: 1 # 报警间隔(单位:s) + - type: change + enabled: true \ No newline at end of file diff --git a/test/test-core/src/test/resources/postprocessor-dtp-dev.yml b/test/test-core/src/test/resources/postprocessor-dtp-dev.yml index c4fc28dc0..b7d8daa5a 100644 --- a/test/test-core/src/test/resources/postprocessor-dtp-dev.yml +++ b/test/test-core/src/test/resources/postprocessor-dtp-dev.yml @@ -20,29 +20,29 @@ management: health: defaults: enabled: true -spring: - dynamic: - tp: - enabled: true - enabledCollect: true # 是否开启监控指标采集,默认false - collectorTypes: micrometer # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - monitorInterval: 5 # 监控时间间隔(报警检测、指标采集),默认5s - executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 - - threadPoolName: asyncExecutor - threadPoolAliasName: 异步线程池 # 线程池别名 - executorType: common # 线程池类型common、eager:适用于io密集型 - corePoolSize: 3 - maximumPoolSize: 10 - queueCapacity: 100 - queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 - rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 - keepAliveTime: 50 - allowCoreThreadTimeOut: false # 是否允许核心线程池超时 - threadNamePrefix: AsyncThread- # 线程名前缀 - waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 - awaitTerminationSeconds: 5 # 单位(s) - preStartAllCoreThreads: false # 是否预热所有核心线程,默认false - runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) - queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) - taskWrapperNames: [ "ttl", "mdc","cta" ] # 任务包装器名称,继承TaskWrapper接口 - notifyEnabled: false # 是否开启报警,默认true \ No newline at end of file + + +dynamictp: + enabled: true + enabledCollect: true # 是否开启监控指标采集,默认false + collectorTypes: micrometer # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + monitorInterval: 5 # 监控时间间隔(报警检测、指标采集),默认5s + executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 + - threadPoolName: asyncExecutor + threadPoolAliasName: 异步线程池 # 线程池别名 + executorType: common # 线程池类型common、eager:适用于io密集型 + corePoolSize: 3 + maximumPoolSize: 10 + queueCapacity: 100 + queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类 + rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类 + keepAliveTime: 50 + allowCoreThreadTimeOut: false # 是否允许核心线程池超时 + threadNamePrefix: AsyncThread- # 线程名前缀 + waitForTasksToCompleteOnShutdown: false # 参考spring线程池设计,优雅关闭线程池 + awaitTerminationSeconds: 5 # 单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 200 # 任务执行超时阈值,目前只做告警用,单位(ms) + queueTimeout: 100 # 任务在队列等待超时阈值,目前只做告警用,单位(ms) + taskWrapperNames: [ "ttl", "mdc","cta" ] # 任务包装器名称,继承TaskWrapper接口 + notifyEnabled: false # 是否开启报警,默认true \ No newline at end of file