diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index eb15bc5e..6e54c6c7 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,3 @@ # These are supported funding model platforms -custom: ['https://hippo4j.cn/docs/community/sponsor'] +custom: ['https://hippo4j.cn/community/sponsor'] diff --git a/docs/docs/user_docs/getting_started/server/hippo4j-server-monitor.md b/docs/docs/user_docs/getting_started/server/hippo4j-server-monitor.md index b743c790..4a81a47b 100644 --- a/docs/docs/user_docs/getting_started/server/hippo4j-server-monitor.md +++ b/docs/docs/user_docs/getting_started/server/hippo4j-server-monitor.md @@ -47,6 +47,16 @@ spring: thread-pool-types: dynamic # 采集线程池的类型。eg:dynamic、web、adapter。可任意配置,默认 dynamic ``` +如果使用 `micrometer` 类型的监控指标,需要添加以下依赖。 + +```xml + + cn.hippo4j + hippo4j-spring-boot-starter-monitor-micrometer + 1.4.3-upgrade + +``` + 项目启动,访问 `http://localhost:29999/actuator/prometheus` 出现 `dynamic_thread_pool_` 前缀的指标,即为成功。 ![](https://images-machen.oss-cn-beijing.aliyuncs.com/image-20220912220401016.png) diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 7c38db7b..8ff7a975 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -116,7 +116,7 @@ const config = { }, { href: 'https://xiaomage.info/knowledge-planet', - label: '🥇代码实战课', + label: '知识星球', position: 'left', }, { diff --git a/docs/i18n/zh/docusaurus-plugin-content-docs/current/user_docs/getting_started/server/hippo4j-server-monitor.md b/docs/i18n/zh/docusaurus-plugin-content-docs/current/user_docs/getting_started/server/hippo4j-server-monitor.md index b743c790..4a81a47b 100644 --- a/docs/i18n/zh/docusaurus-plugin-content-docs/current/user_docs/getting_started/server/hippo4j-server-monitor.md +++ b/docs/i18n/zh/docusaurus-plugin-content-docs/current/user_docs/getting_started/server/hippo4j-server-monitor.md @@ -47,6 +47,16 @@ spring: thread-pool-types: dynamic # 采集线程池的类型。eg:dynamic、web、adapter。可任意配置,默认 dynamic ``` +如果使用 `micrometer` 类型的监控指标,需要添加以下依赖。 + +```xml + + cn.hippo4j + hippo4j-spring-boot-starter-monitor-micrometer + 1.4.3-upgrade + +``` + 项目启动,访问 `http://localhost:29999/actuator/prometheus` 出现 `dynamic_thread_pool_` 前缀的指标,即为成功。 ![](https://images-machen.oss-cn-beijing.aliyuncs.com/image-20220912220401016.png) diff --git a/docs/i18n/zh/docusaurus-plugin-content-docs/version-1.4.3/user_docs/getting_started/server/hippo4j-server-monitor.md b/docs/i18n/zh/docusaurus-plugin-content-docs/version-1.4.3/user_docs/getting_started/server/hippo4j-server-monitor.md index b743c790..4a81a47b 100644 --- a/docs/i18n/zh/docusaurus-plugin-content-docs/version-1.4.3/user_docs/getting_started/server/hippo4j-server-monitor.md +++ b/docs/i18n/zh/docusaurus-plugin-content-docs/version-1.4.3/user_docs/getting_started/server/hippo4j-server-monitor.md @@ -47,6 +47,16 @@ spring: thread-pool-types: dynamic # 采集线程池的类型。eg:dynamic、web、adapter。可任意配置,默认 dynamic ``` +如果使用 `micrometer` 类型的监控指标,需要添加以下依赖。 + +```xml + + cn.hippo4j + hippo4j-spring-boot-starter-monitor-micrometer + 1.4.3-upgrade + +``` + 项目启动,访问 `http://localhost:29999/actuator/prometheus` 出现 `dynamic_thread_pool_` 前缀的指标,即为成功。 ![](https://images-machen.oss-cn-beijing.aliyuncs.com/image-20220912220401016.png) diff --git a/docs/versioned_docs/version-1.4.3/user_docs/getting_started/server/hippo4j-server-monitor.md b/docs/versioned_docs/version-1.4.3/user_docs/getting_started/server/hippo4j-server-monitor.md index b743c790..4a81a47b 100644 --- a/docs/versioned_docs/version-1.4.3/user_docs/getting_started/server/hippo4j-server-monitor.md +++ b/docs/versioned_docs/version-1.4.3/user_docs/getting_started/server/hippo4j-server-monitor.md @@ -47,6 +47,16 @@ spring: thread-pool-types: dynamic # 采集线程池的类型。eg:dynamic、web、adapter。可任意配置,默认 dynamic ``` +如果使用 `micrometer` 类型的监控指标,需要添加以下依赖。 + +```xml + + cn.hippo4j + hippo4j-spring-boot-starter-monitor-micrometer + 1.4.3-upgrade + +``` + 项目启动,访问 `http://localhost:29999/actuator/prometheus` 出现 `dynamic_thread_pool_` 前缀的指标,即为成功。 ![](https://images-machen.oss-cn-beijing.aliyuncs.com/image-20220912220401016.png) diff --git a/hippo4j-message/src/main/java/cn/hippo4j/message/platform/DingSendMessageHandler.java b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/DingSendMessageHandler.java index a8329e07..e7c078e3 100644 --- a/hippo4j-message/src/main/java/cn/hippo4j/message/platform/DingSendMessageHandler.java +++ b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/DingSendMessageHandler.java @@ -92,13 +92,11 @@ public class DingSendMessageHandler extends AbstractRobotSendMessageHandler { String title = Objects.equals(notifyConfig.getType(), "CONFIG") ? DING_NOTICE_TITLE : DING_ALARM_TITLE; String text = robotMessageExecuteDTO.getText(); ArrayList atMobiles = CollectionUtil.newArrayList(notifyConfig.getReceives().split(",")); - HashMap markdown = new HashMap<>(); markdown.put("title", title); markdown.put("text", text); HashMap at = new HashMap<>(); at.put("atMobiles", atMobiles); - HashMap markdownJson = new HashMap<>(); markdownJson.put("msgtype", "markdown"); markdownJson.put("markdown", markdown); @@ -106,18 +104,29 @@ public class DingSendMessageHandler extends AbstractRobotSendMessageHandler { try { String responseBody = HttpUtil.post(serverUrl, markdownJson); DingRobotResponse response = JSONUtil.parseObject(responseBody, DingRobotResponse.class); - Assert.isTrue(response != null, "response is null"); + Assert.isTrue(response != null, "Response is null."); if (response.getErrcode() != 0) { - log.error("Ding failed to send message,reason : {}", response.errmsg); + log.error("Ding failed to send message, reason : {}", response.errmsg); } } catch (Exception ex) { - log.error("Ding failed to send message", ex); + log.error("Ding failed to send message.", ex); } } + /** + * Ding robot response. + */ @Data static class DingRobotResponse { + + /** + * Error code + */ private Long errcode; + + /** + * Error message + */ private String errmsg; } } diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/DynamicThreadPoolAutoConfiguration.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/DynamicThreadPoolAutoConfiguration.java index 51edf16c..62467060 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/DynamicThreadPoolAutoConfiguration.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/DynamicThreadPoolAutoConfiguration.java @@ -21,7 +21,7 @@ import cn.hippo4j.common.api.ThreadPoolCheckAlarm; import cn.hippo4j.common.api.ThreadPoolConfigChange; import cn.hippo4j.common.config.ApplicationContextHolder; import cn.hippo4j.config.springboot.starter.monitor.ThreadPoolMonitorExecutor; -import cn.hippo4j.config.springboot.starter.notify.CoreNotifyConfigBuilder; +import cn.hippo4j.config.springboot.starter.notify.ConfigModeNotifyConfigBuilder; import cn.hippo4j.config.springboot.starter.refresher.event.AdapterExecutorsRefreshListener; import cn.hippo4j.config.springboot.starter.refresher.event.DynamicThreadPoolRefreshListener; import cn.hippo4j.config.springboot.starter.refresher.event.PlatformsRefreshListener; @@ -77,7 +77,7 @@ public class DynamicThreadPoolAutoConfiguration { @Bean public NotifyConfigBuilder notifyConfigBuilder(AlarmControlHandler alarmControlHandler) { - return new CoreNotifyConfigBuilder(alarmControlHandler, bootstrapConfigProperties); + return new ConfigModeNotifyConfigBuilder(alarmControlHandler, bootstrapConfigProperties); } @Bean @@ -105,9 +105,9 @@ public class DynamicThreadPoolAutoConfiguration { @Bean @SuppressWarnings("all") public DynamicThreadPoolRefreshListener hippo4jExecutorsListener(ThreadPoolConfigChange threadPoolConfigChange, - CoreNotifyConfigBuilder coreNotifyConfigBuilder, + ConfigModeNotifyConfigBuilder configModeNotifyConfigBuilder, Hippo4jBaseSendMessageService hippoBaseSendMessageService) { - return new DynamicThreadPoolRefreshListener(threadPoolConfigChange, coreNotifyConfigBuilder, hippoBaseSendMessageService); + return new DynamicThreadPoolRefreshListener(threadPoolConfigChange, configModeNotifyConfigBuilder, hippoBaseSendMessageService); } @Bean diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/notify/CoreNotifyConfigBuilder.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/notify/ConfigModeNotifyConfigBuilder.java similarity index 98% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/notify/CoreNotifyConfigBuilder.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/notify/ConfigModeNotifyConfigBuilder.java index 9dba54a8..7a01ae4e 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/notify/CoreNotifyConfigBuilder.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/notify/ConfigModeNotifyConfigBuilder.java @@ -32,11 +32,11 @@ import java.util.*; import java.util.stream.Collectors; /** - * Core notify config builder. + * Config mode notify config builder. */ @AllArgsConstructor @Slf4j -public class CoreNotifyConfigBuilder implements NotifyConfigBuilder { +public class ConfigModeNotifyConfigBuilder implements NotifyConfigBuilder { private final AlarmControlHandler alarmControlHandler; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/DynamicThreadPoolRefreshListener.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/DynamicThreadPoolRefreshListener.java index fe30533c..4ed28af4 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/DynamicThreadPoolRefreshListener.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/DynamicThreadPoolRefreshListener.java @@ -24,7 +24,7 @@ import cn.hippo4j.common.executor.support.ResizableCapacityLinkedBlockingQueue; import cn.hippo4j.common.toolkit.CollectionUtil; import cn.hippo4j.config.springboot.starter.config.BootstrapConfigProperties; import cn.hippo4j.config.springboot.starter.config.ExecutorProperties; -import cn.hippo4j.config.springboot.starter.notify.CoreNotifyConfigBuilder; +import cn.hippo4j.config.springboot.starter.notify.ConfigModeNotifyConfigBuilder; import cn.hippo4j.config.springboot.starter.support.GlobalCoreThreadPoolManage; import cn.hippo4j.core.executor.DynamicThreadPoolExecutor; import cn.hippo4j.core.executor.manage.GlobalThreadPoolManage; @@ -60,7 +60,7 @@ public class DynamicThreadPoolRefreshListener extends AbstractRefreshListener changeKeys = new ArrayList<>(); - Map> newDynamicThreadPoolNotifyMap = coreNotifyConfigBuilder.buildSingleNotifyConfig(executorProperties); + Map> newDynamicThreadPoolNotifyMap = configModeNotifyConfigBuilder.buildSingleNotifyConfig(executorProperties); Map> notifyConfigs = hippo4jBaseSendMessageService.getNotifyConfigs(); if (CollectionUtil.isNotEmpty(notifyConfigs)) { for (Map.Entry> each : newDynamicThreadPoolNotifyMap.entrySet()) { @@ -183,7 +183,7 @@ public class DynamicThreadPoolRefreshListener extends AbstractRefreshListener> notifyConfig = configBuilder.buildSingleNotifyConfig(executorProperties); sendMessageService.putPlatform(notifyConfig); wrapper.setInitFlag(Boolean.TRUE); diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/DynamicThreadPoolAutoConfiguration.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/DynamicThreadPoolAutoConfiguration.java index c271fac4..2650fb11 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/DynamicThreadPoolAutoConfiguration.java +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/DynamicThreadPoolAutoConfiguration.java @@ -52,7 +52,7 @@ import cn.hippo4j.springboot.starter.monitor.ReportingEventExecutor; import cn.hippo4j.springboot.starter.monitor.collect.RunTimeInfoCollector; import cn.hippo4j.springboot.starter.monitor.send.MessageSender; import cn.hippo4j.springboot.starter.monitor.send.http.HttpConnectSender; -import cn.hippo4j.springboot.starter.notify.ServerNotifyConfigBuilder; +import cn.hippo4j.springboot.starter.notify.ServerModeNotifyConfigBuilder; import cn.hippo4j.springboot.starter.remote.HttpAgent; import cn.hippo4j.springboot.starter.remote.HttpScheduledHealthCheck; import cn.hippo4j.springboot.starter.remote.ServerHealthCheck; @@ -116,10 +116,10 @@ public class DynamicThreadPoolAutoConfiguration { @SuppressWarnings("all") public DynamicThreadPoolService dynamicThreadPoolConfigService(HttpAgent httpAgent, ServerHealthCheck serverHealthCheck, - ServerNotifyConfigBuilder notifyConfigBuilder, + ServerModeNotifyConfigBuilder serverModeNotifyConfigBuilder, Hippo4jBaseSendMessageService hippo4jBaseSendMessageService, DynamicThreadPoolSubscribeConfig dynamicThreadPoolSubscribeConfig) { - return new DynamicThreadPoolConfigService(httpAgent, properties, notifyConfigBuilder, hippo4jBaseSendMessageService, dynamicThreadPoolSubscribeConfig); + return new DynamicThreadPoolConfigService(httpAgent, properties, serverModeNotifyConfigBuilder, hippo4jBaseSendMessageService, dynamicThreadPoolSubscribeConfig); } @Bean @@ -205,7 +205,7 @@ public class DynamicThreadPoolAutoConfiguration { public NotifyConfigBuilder serverNotifyConfigBuilder(HttpAgent httpAgent, BootstrapProperties properties, AlarmControlHandler alarmControlHandler) { - return new ServerNotifyConfigBuilder(httpAgent, properties, alarmControlHandler); + return new ServerModeNotifyConfigBuilder(httpAgent, properties, alarmControlHandler); } @Bean diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/notify/ServerNotifyConfigBuilder.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/notify/ServerModeNotifyConfigBuilder.java similarity index 97% rename from hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/notify/ServerNotifyConfigBuilder.java rename to hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/notify/ServerModeNotifyConfigBuilder.java index 8aeedb98..3cfbe586 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/notify/ServerNotifyConfigBuilder.java +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/notify/ServerModeNotifyConfigBuilder.java @@ -41,11 +41,11 @@ import java.util.Objects; import static cn.hippo4j.common.constant.Constants.BASE_PATH; /** - * Server notify config builder. + * Server mode notify config builder. */ @Slf4j @AllArgsConstructor -public class ServerNotifyConfigBuilder implements NotifyConfigBuilder { +public class ServerModeNotifyConfigBuilder implements NotifyConfigBuilder { private final HttpAgent httpAgent; diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/support/DynamicThreadPoolConfigService.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/support/DynamicThreadPoolConfigService.java index 663b07dc..f648b346 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/support/DynamicThreadPoolConfigService.java +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/support/DynamicThreadPoolConfigService.java @@ -35,7 +35,7 @@ import cn.hippo4j.message.service.Hippo4jBaseSendMessageService; import cn.hippo4j.message.service.ThreadPoolNotifyAlarm; import cn.hippo4j.springboot.starter.config.BootstrapProperties; import cn.hippo4j.springboot.starter.core.DynamicThreadPoolSubscribeConfig; -import cn.hippo4j.springboot.starter.notify.ServerNotifyConfigBuilder; +import cn.hippo4j.springboot.starter.notify.ServerModeNotifyConfigBuilder; import cn.hippo4j.springboot.starter.remote.HttpAgent; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -58,7 +58,7 @@ public class DynamicThreadPoolConfigService extends AbstractDynamicThreadPoolSer private final BootstrapProperties properties; - private final ServerNotifyConfigBuilder notifyConfigBuilder; + private final ServerModeNotifyConfigBuilder serverModeNotifyConfigBuilder; private final Hippo4jBaseSendMessageService hippo4jBaseSendMessageService; @@ -108,7 +108,7 @@ public class DynamicThreadPoolConfigService extends AbstractDynamicThreadPoolSer registerParameter.getActiveAlarm(), registerParameter.getCapacityAlarm()); GlobalNotifyAlarmManage.put(registerParameter.getThreadPoolId(), threadPoolNotifyAlarm); - Map> builderNotify = notifyConfigBuilder.getAndInitNotify(CollectionUtil.newArrayList(registerParameter.getThreadPoolId())); + Map> builderNotify = serverModeNotifyConfigBuilder.getAndInitNotify(CollectionUtil.newArrayList(registerParameter.getThreadPoolId())); hippo4jBaseSendMessageService.putPlatform(builderNotify); }