From 31c2552aee859725dbeb0ef946f4dbaf093da216 Mon Sep 17 00:00:00 2001
From: lucky 8 <40255310+shining-stars-lk@users.noreply.github.com>
Date: Thu, 4 Aug 2022 17:47:36 +0800
Subject: [PATCH 1/7] Add frequently asked questions (#440)
* Added the description of setting parameter priority
* Added the description of setting parameter priority
* Added Modified the description of queue capacity
* Added Modified the description of queue capacity
---
docs/docs/user_docs/other/issue.md | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/docs/docs/user_docs/other/issue.md b/docs/docs/user_docs/other/issue.md
index 2fdffb0e..90121b14 100644
--- a/docs/docs/user_docs/other/issue.md
+++ b/docs/docs/user_docs/other/issue.md
@@ -13,7 +13,8 @@ sidebar_position: 2
- Server 端宕机会影响 Client 运行么
- Hippo4J 的发布方式是怎样的?如何选择正确的版本
- 群机器人接受不到通知报警
-
+- 设置线程池参数优先级问题
+- 线程池实例中修改队列容量参数问题
## 租户和项目在 Hippo4J 中是什么意思
@@ -77,3 +78,11 @@ Hippo4J 发布时可能会涉及到两端发布,分别是 Server 和 Starter
如果使用 hippo4j-server,请检查在 hippo4j-server 添加的报警通知记录,是否在客户端项目启动前,因为客户端只有在启动时会去 hippo4j-server 拉取报警通知记录。
重启客户端项目,会重新拉取最新报警推送配置,问题解决。
+
+## 设置线程池参数优先级问题
+- 当使用`@DynamicThreadPool`进行修饰的方法中和在管理界面设置中同时存在的话,则管理界面设置的优先级最高;
+- 如果连接service端失败的话,使用`@DynamicThreadPool`进行修饰设置的优先级最高。
+
+## 线程池实例中修改队列容量参数问题
+
+在线程池管理中添加时,只有当选择队列类型为`ResizableCapacityLinkedBlockingQueue`时,后续再进行修改容量大小时才会实时的刷新修改成功。
\ No newline at end of file
From ed46e0767ec2e92f8eba636248c2a85d9b54127d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=8F=E9=A9=AC=E5=93=A5?=
Date: Thu, 4 Aug 2022 20:31:29 +0800
Subject: [PATCH 2/7] Spotless add skip condition (#444)
---
pom.xml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pom.xml b/pom.xml
index f482039a..b4c2dbf8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,6 +61,7 @@
1.8
true
+ false
false
UTF-8
UTF-8
@@ -381,6 +382,7 @@
spotless-maven-plugin
${spotless-maven-plugin.version}
+ ${skip.spotless.apply}
${maven.multiModuleProjectDirectory}/dev-support/hippo4j_spotless_formatter.xml
From 2a9f94cd35c0f9a16770f9d1d86cce94a4d45509 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=8F=E9=A9=AC=E5=93=A5?=
Date: Thu, 4 Aug 2022 20:33:36 +0800
Subject: [PATCH 3/7] Optimize notification and alarm text reading (#445)
* Spotless add skip condition
* Optimize notification and alarm text reading
* delete meaningless blank lines
---
.../cn/hippo4j/common/toolkit/FileUtil.java | 49 +++++++++++++++++++
.../cn/hippo4j/common/toolkit/Singleton.java | 1 -
.../platform/DingSendMessageHandler.java | 2 +-
.../platform/LarkSendMessageHandler.java | 2 +-
.../platform/WeChatSendMessageHandler.java | 10 ++--
5 files changed, 56 insertions(+), 8 deletions(-)
create mode 100644 hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/FileUtil.java
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/FileUtil.java b/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/FileUtil.java
new file mode 100644
index 00000000..8868d0c7
--- /dev/null
+++ b/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/FileUtil.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.hippo4j.common.toolkit;
+
+import lombok.SneakyThrows;
+import org.springframework.core.io.ClassPathResource;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+/**
+ * File util;
+ */
+public class FileUtil {
+
+ @SneakyThrows
+ public static String readUtf8String(String path) {
+ String resultReadStr;
+ ClassPathResource classPathResource = new ClassPathResource(path);
+ try (
+ InputStream inputStream = classPathResource.getInputStream();
+ BufferedInputStream bis = new BufferedInputStream(inputStream);
+ ByteArrayOutputStream buf = new ByteArrayOutputStream()) {
+ int result = bis.read();
+ while (result != -1) {
+ buf.write((byte) result);
+ result = bis.read();
+ }
+ resultReadStr = buf.toString("UTF-8");
+ }
+ return resultReadStr;
+ }
+}
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/Singleton.java b/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/Singleton.java
index edb83a57..4e5ef959 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/Singleton.java
+++ b/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/Singleton.java
@@ -43,7 +43,6 @@ public final class Singleton {
return result == null ? null : (T) result;
}
-
/**
* Get a singleton object by key.
*
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 f2b6bd87..ad2f2a33 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
@@ -25,7 +25,7 @@ import cn.hippo4j.message.platform.base.AbstractRobotSendMessageHandler;
import cn.hippo4j.message.platform.base.RobotMessageActualContent;
import cn.hippo4j.message.platform.base.RobotMessageExecuteDTO;
import cn.hippo4j.message.platform.constant.DingAlarmConstants;
-import cn.hutool.core.io.FileUtil;
+import cn.hippo4j.common.toolkit.FileUtil;
import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiRobotSendRequest;
diff --git a/hippo4j-message/src/main/java/cn/hippo4j/message/platform/LarkSendMessageHandler.java b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/LarkSendMessageHandler.java
index ab5b4413..02c2a470 100644
--- a/hippo4j-message/src/main/java/cn/hippo4j/message/platform/LarkSendMessageHandler.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/LarkSendMessageHandler.java
@@ -26,7 +26,7 @@ import cn.hippo4j.message.request.AlarmNotifyRequest;
import cn.hippo4j.message.request.ChangeParameterNotifyRequest;
import cn.hippo4j.common.toolkit.StringUtil;
import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.io.FileUtil;
+import cn.hippo4j.common.toolkit.FileUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import lombok.AllArgsConstructor;
diff --git a/hippo4j-message/src/main/java/cn/hippo4j/message/platform/WeChatSendMessageHandler.java b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/WeChatSendMessageHandler.java
index b10bad18..13ec43af 100644
--- a/hippo4j-message/src/main/java/cn/hippo4j/message/platform/WeChatSendMessageHandler.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/WeChatSendMessageHandler.java
@@ -17,13 +17,13 @@
package cn.hippo4j.message.platform;
+import cn.hippo4j.common.toolkit.FileUtil;
import cn.hippo4j.common.toolkit.JSONUtil;
import cn.hippo4j.common.toolkit.Singleton;
import cn.hippo4j.message.enums.NotifyPlatformEnum;
import cn.hippo4j.message.platform.base.AbstractRobotSendMessageHandler;
import cn.hippo4j.message.platform.base.RobotMessageActualContent;
import cn.hippo4j.message.platform.base.RobotMessageExecuteDTO;
-import cn.hutool.core.io.FileUtil;
import cn.hutool.http.HttpRequest;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -44,15 +44,15 @@ public class WeChatSendMessageHandler extends AbstractRobotSendMessageHandler {
@Override
protected RobotMessageActualContent buildMessageActualContent() {
- String weChatAlarmTxtKet = "message/robot/dynamic-thread-pool/wechat-alarm.txt";
- String weChatConfigTxtKet = "message/robot/dynamic-thread-pool/wechat-alarm.txt";
+ String weChatAlarmTxtKey = "message/robot/dynamic-thread-pool/wechat-alarm.txt";
+ String weChatConfigTxtKey = "message/robot/dynamic-thread-pool/wechat-alarm.txt";
RobotMessageActualContent robotMessageActualContent = RobotMessageActualContent.builder()
.receiveSeparator("><@")
.changeSeparator(" ➲ ")
.replaceTxt(WE_CHAT_ALARM_TIMOUT_REPLACE_TXT)
.traceReplaceTxt(WE_CHAT_ALARM_TIMOUT_TRACE_REPLACE_TXT)
- .alarmMessageContent(Singleton.get(weChatAlarmTxtKet, () -> FileUtil.readUtf8String(weChatAlarmTxtKet)))
- .configMessageContent(Singleton.get(weChatConfigTxtKet, () -> FileUtil.readUtf8String(weChatConfigTxtKet)))
+ .alarmMessageContent(Singleton.get(weChatAlarmTxtKey, () -> FileUtil.readUtf8String(weChatAlarmTxtKey)))
+ .configMessageContent(Singleton.get(weChatConfigTxtKey, () -> FileUtil.readUtf8String(weChatConfigTxtKey)))
.build();
return robotMessageActualContent;
}
From 25aed76dbd1c971de00094a824564d4084f29503 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=8F=E9=A9=AC=E5=93=A5?=
Date: Thu, 4 Aug 2022 20:35:01 +0800
Subject: [PATCH 4/7] Develop 3921 (#446)
* Spotless add skip condition
* Optimize notification and alarm text reading
* delete meaningless blank lines
* hippo4j springboot starter adds prometheus monitoring
---
.../hippo4j-spring-boot-starter-example/pom.xml | 10 ++++++++++
.../src/main/resources/application.properties | 9 ++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/hippo4j-example/hippo4j-spring-boot-starter-example/pom.xml b/hippo4j-example/hippo4j-spring-boot-starter-example/pom.xml
index 830e8834..84572a63 100644
--- a/hippo4j-example/hippo4j-spring-boot-starter-example/pom.xml
+++ b/hippo4j-example/hippo4j-spring-boot-starter-example/pom.xml
@@ -26,6 +26,16 @@
${revision}
+
+ io.micrometer
+ micrometer-registry-prometheus
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
org.springframework.boot
spring-boot-starter-web
diff --git a/hippo4j-example/hippo4j-spring-boot-starter-example/src/main/resources/application.properties b/hippo4j-example/hippo4j-spring-boot-starter-example/src/main/resources/application.properties
index f36d13d0..6647ba01 100644
--- a/hippo4j-example/hippo4j-spring-boot-starter-example/src/main/resources/application.properties
+++ b/hippo4j-example/hippo4j-spring-boot-starter-example/src/main/resources/application.properties
@@ -2,14 +2,21 @@ server.port=8088
server.servlet.context-path=/example
+management.metrics.export.prometheus.enabled=true
+management.server.port=29901
+management.endpoints.web.exposure.include=*
+
spring.profiles.active=dev
spring.application.name=dynamic-threadpool-example
spring.dynamic.thread-pool.server-addr=http://localhost:6691
-spring.dynamic.thread-pool.netty-server-port=8899
### Use netty to report thread pool monitoring data. The default is http.
# spring.dynamic.thread-pool.report-type=netty
+# spring.dynamic.thread-pool.netty-server-port=8899
spring.dynamic.thread-pool.namespace=prescription
spring.dynamic.thread-pool.item-id=dynamic-threadpool-example
spring.dynamic.thread-pool.username=admin
spring.dynamic.thread-pool.password=123456
+
+# Enable server and prometheus monitoring at the same time
+spring.dynamic.thread-pool.collect-type=server,prometheus
From 3d52b473de6fd4d0b9e1e5f928b788bf785f2803 Mon Sep 17 00:00:00 2001
From: alexli <46749051+alexhaoxuan@users.noreply.github.com>
Date: Fri, 5 Aug 2022 11:14:28 +0800
Subject: [PATCH 5/7] Update hippo4j-server-start.md (#452)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
fix:修改文档返回值不对问题
---
docs/docs/user_docs/getting-started/hippo4j-server-start.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/docs/user_docs/getting-started/hippo4j-server-start.md b/docs/docs/user_docs/getting-started/hippo4j-server-start.md
index d5f4238b..859776b1 100644
--- a/docs/docs/user_docs/getting-started/hippo4j-server-start.md
+++ b/docs/docs/user_docs/getting-started/hippo4j-server-start.md
@@ -101,7 +101,7 @@ public class ThreadPoolConfig {
.threadPoolId(threadPoolId)
.dynamicPool()
.build();
- return dynamicExecutor;
+ return messageProduceDynamicExecutor;
}
}
From 8e7e62c2f5002989818e75a1cde90d393771ac95 Mon Sep 17 00:00:00 2001
From: linlinjie <448984863@qq.com>
Date: Fri, 5 Aug 2022 12:16:14 +0800
Subject: [PATCH 6/7] Optimize client health check time delay mechanism (#450)
---
.../starter/remote/AbstractHealthCheck.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/remote/AbstractHealthCheck.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/remote/AbstractHealthCheck.java
index b013ead8..f90188d8 100644
--- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/remote/AbstractHealthCheck.java
+++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/remote/AbstractHealthCheck.java
@@ -17,6 +17,7 @@
package cn.hippo4j.springboot.starter.remote;
+import cn.hippo4j.common.toolkit.ThreadUtil;
import cn.hippo4j.springboot.starter.event.ApplicationCompleteEvent;
import cn.hippo4j.springboot.starter.core.ShutdownExecuteException;
import cn.hippo4j.core.executor.support.ThreadFactoryBuilder;
@@ -47,6 +48,11 @@ public abstract class AbstractHealthCheck implements ServerHealthCheck, Initiali
*/
private volatile boolean healthStatus = true;
+ /**
+ * Health check failure count
+ */
+ private volatile int checkFailureCount = 0;
+
/**
* Client shutdown hook
*/
@@ -89,11 +95,18 @@ public abstract class AbstractHealthCheck implements ServerHealthCheck, Initiali
if (healthCheckStatus) {
if (Objects.equals(healthStatus, false)) {
healthStatus = true;
+ checkFailureCount = 0;
log.info("The client reconnects to the server successfully.");
signalAllBizThread();
}
} else {
healthStatus = false;
+ checkFailureCount++;
+ if (checkFailureCount > 1 && checkFailureCount < 4) {
+ ThreadUtil.sleep(HEALTH_CHECK_INTERVAL * 1000 * (checkFailureCount - 1));
+ } else if (checkFailureCount >= 4) {
+ ThreadUtil.sleep(25000L);
+ }
}
}
From b34c84f97d96bc40a35c7ea07c09ad2f8aa59dec Mon Sep 17 00:00:00 2001
From: maxisvest <1447829379@qq.com>
Date: Fri, 5 Aug 2022 14:43:36 +0800
Subject: [PATCH 7/7] Add es monitor support (#451)
* first commit
* modify something
* modify something
* modify log content
* format code
---
.../pom.xml | 78 +++++++++
.../Hippo4JExampleEsMonitorApplication.java | 31 ++++
.../src/main/resources/application.properties | 41 +++++
hippo4j-example/pom.xml | 1 +
.../example/monitor/base/MonitorTypeEnum.java | 2 +-
hippo4j-monitor/hippo4j-monitor-es/pom.xml | 81 ++++++++++
.../cn/hippo4j/monitor/es/EsClientHolder.java | 98 ++++++++++++
.../hippo4j/monitor/es/EsMonitorHandler.java | 149 ++++++++++++++++++
.../es/model/EsThreadPoolRunStateInfo.java | 36 +++++
.../src/main/resources/mapping.json | 78 +++++++++
hippo4j-monitor/pom.xml | 1 +
.../hippo4j-core-spring-boot-starter/pom.xml | 6 +
...ynamicThreadPoolCoreAutoConfiguration.java | 3 +-
.../config/MonitorHandlerConfiguration.java | 11 ++
.../config/condition/EsMonitorCondition.java | 37 +++++
.../hippo4j-spring-boot-starter/pom.xml | 6 +
.../monitor/ReportingEventExecutor.java | 3 +-
pom.xml | 1 +
18 files changed, 660 insertions(+), 3 deletions(-)
create mode 100644 hippo4j-example/hippo4j-spring-boot-starter-es-monitor-example/pom.xml
create mode 100644 hippo4j-example/hippo4j-spring-boot-starter-es-monitor-example/src/main/java/cn/hippo4j/example/es/monitor/Hippo4JExampleEsMonitorApplication.java
create mode 100644 hippo4j-example/hippo4j-spring-boot-starter-es-monitor-example/src/main/resources/application.properties
create mode 100644 hippo4j-monitor/hippo4j-monitor-es/pom.xml
create mode 100644 hippo4j-monitor/hippo4j-monitor-es/src/main/java/cn/hippo4j/monitor/es/EsClientHolder.java
create mode 100644 hippo4j-monitor/hippo4j-monitor-es/src/main/java/cn/hippo4j/monitor/es/EsMonitorHandler.java
create mode 100644 hippo4j-monitor/hippo4j-monitor-es/src/main/java/cn/hippo4j/monitor/es/model/EsThreadPoolRunStateInfo.java
create mode 100644 hippo4j-monitor/hippo4j-monitor-es/src/main/resources/mapping.json
create mode 100644 hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/condition/EsMonitorCondition.java
diff --git a/hippo4j-example/hippo4j-spring-boot-starter-es-monitor-example/pom.xml b/hippo4j-example/hippo4j-spring-boot-starter-es-monitor-example/pom.xml
new file mode 100644
index 00000000..68b75f51
--- /dev/null
+++ b/hippo4j-example/hippo4j-spring-boot-starter-es-monitor-example/pom.xml
@@ -0,0 +1,78 @@
+
+
+ 4.0.0
+
+ cn.hippo4j
+ hippo4j-example
+ ${revision}
+
+ hippo4j-spring-boot-starter-es-monitor-example
+
+
+ true
+
+
+
+
+ cn.hippo4j
+ hippo4j-example-core
+ ${revision}
+
+
+
+ cn.hippo4j
+ hippo4j-core-spring-boot-starter
+ ${revision}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.apache.tomcat.embed
+ tomcat-embed-core
+ ${tomcat-embed-core.version}
+
+
+
+
+
+
+
+
+
+
+ ${project.artifactId}
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
+
+
+
+
diff --git a/hippo4j-example/hippo4j-spring-boot-starter-es-monitor-example/src/main/java/cn/hippo4j/example/es/monitor/Hippo4JExampleEsMonitorApplication.java b/hippo4j-example/hippo4j-spring-boot-starter-es-monitor-example/src/main/java/cn/hippo4j/example/es/monitor/Hippo4JExampleEsMonitorApplication.java
new file mode 100644
index 00000000..83903493
--- /dev/null
+++ b/hippo4j-example/hippo4j-spring-boot-starter-es-monitor-example/src/main/java/cn/hippo4j/example/es/monitor/Hippo4JExampleEsMonitorApplication.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.hippo4j.example.es.monitor;
+
+import cn.hippo4j.core.enable.EnableDynamicThreadPool;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@EnableDynamicThreadPool
+@SpringBootApplication(scanBasePackages = {"cn.hippo4j.example.core", "cn.hippo4j.monitor"})
+public class Hippo4JExampleEsMonitorApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Hippo4JExampleEsMonitorApplication.class, args);
+ }
+}
diff --git a/hippo4j-example/hippo4j-spring-boot-starter-es-monitor-example/src/main/resources/application.properties b/hippo4j-example/hippo4j-spring-boot-starter-es-monitor-example/src/main/resources/application.properties
new file mode 100644
index 00000000..76febf01
--- /dev/null
+++ b/hippo4j-example/hippo4j-spring-boot-starter-es-monitor-example/src/main/resources/application.properties
@@ -0,0 +1,41 @@
+server.port=8088
+
+server.servlet.context-path=/example
+
+spring.profiles.active=dev
+spring.application.name=dynamic-threadpool-example
+
+es.thread-pool-state.host = ip1:port,ip2:port
+es.thread-pool-state.scheme = http
+es.thread-pool-state.userName = xxx
+es.thread-pool-state.password = xxx
+es.thread-pool-state.index.name = thread-pool-state
+
+spring.dynamic.thread-pool.item-id=test
+spring.dynamic.thread-pool.enable=true
+spring.dynamic.thread-pool.banner=false
+spring.dynamic.thread-pool.collect=true
+spring.dynamic.thread-pool.collect-type=es
+spring.dynamic.thread-pool.notify-platforms[0].platform=DING
+spring.dynamic.thread-pool.notify-platforms[0].token=xxx
+spring.dynamic.thread-pool.notify-platforms[0].secret=xxx
+spring.dynamic.thread-pool.apollo.namespace=threadpool.yaml
+spring.dynamic.thread-pool.config-file-type=yaml
+spring.dynamic.thread-pool.alarm=true
+spring.dynamic.thread-pool.check-state-interval=3000
+spring.dynamic.thread-pool.capacity-alarm=80
+spring.dynamic.thread-pool.alarm-interval=8
+spring.dynamic.thread-pool.executors[0].thread-pool-id=message-consume
+spring.dynamic.thread-pool.executors[0].core-pool-size=32
+spring.dynamic.thread-pool.executors[0].maximum-pool-size=32
+spring.dynamic.thread-pool.executors[0].queue-capacity=999
+spring.dynamic.thread-pool.executors[0].execute-time-out=1500
+spring.dynamic.thread-pool.executors[0].blocking-queue=ResizableCapacityLinkedBlockIngQueue
+spring.dynamic.thread-pool.executors[0].rejected-handler=CallerRunsPolicy
+spring.dynamic.thread-pool.executors[0].keep-alive-time=1024
+spring.dynamic.thread-pool.executors[0].allow-core-thread-time-out=true
+spring.dynamic.thread-pool.executors[0].thread-name-prefix=untimely-thread-pool
+spring.dynamic.thread-pool.executors[0].notify.is-alarm=true
+spring.dynamic.thread-pool.executors[0].notify.capacity-alarm=20
+spring.dynamic.thread-pool.executors[0].notify.interval=2
+spring.dynamic.thread-pool.executors[0].notify.receive=xxx
diff --git a/hippo4j-example/pom.xml b/hippo4j-example/pom.xml
index 960c53b3..c23f118e 100644
--- a/hippo4j-example/pom.xml
+++ b/hippo4j-example/pom.xml
@@ -13,6 +13,7 @@
hippo4j-example-core
hippo4j-spring-boot-starter-example
+ hippo4j-spring-boot-starter-es-monitor-example
hippo4j-core-nacos-spring-boot-starter-example
hippo4j-core-apollo-spring-boot-starter-example
hippo4j-core-zookeeper-spring-boot-starter-example
diff --git a/hippo4j-monitor/hippo4j-monitor-base/src/main/java/com/example/monitor/base/MonitorTypeEnum.java b/hippo4j-monitor/hippo4j-monitor-base/src/main/java/com/example/monitor/base/MonitorTypeEnum.java
index 4907c8cc..8fbd4b5f 100644
--- a/hippo4j-monitor/hippo4j-monitor-base/src/main/java/com/example/monitor/base/MonitorTypeEnum.java
+++ b/hippo4j-monitor/hippo4j-monitor-base/src/main/java/com/example/monitor/base/MonitorTypeEnum.java
@@ -22,5 +22,5 @@ package com.example.monitor.base;
*/
public enum MonitorTypeEnum {
- LOG, PROMETHEUS, SERVER
+ LOG, PROMETHEUS, SERVER, ES
}
diff --git a/hippo4j-monitor/hippo4j-monitor-es/pom.xml b/hippo4j-monitor/hippo4j-monitor-es/pom.xml
new file mode 100644
index 00000000..7db9f963
--- /dev/null
+++ b/hippo4j-monitor/hippo4j-monitor-es/pom.xml
@@ -0,0 +1,81 @@
+
+
+ 4.0.0
+
+ cn.hippo4j
+ hippo4j-monitor
+ ${revision}
+
+ hippo4j-monitor-es
+
+
+
+ cn.hippo4j
+ hippo4j-monitor-base
+ ${revision}
+
+
+
+ io.micrometer
+ micrometer-core
+ ${micrometer-core.version}
+
+
+
+ org.elasticsearch
+ elasticsearch
+ ${elasticsearch.version}
+
+
+ org.elasticsearch.client
+ transport
+ ${elasticsearch.version}
+
+
+ org.elasticsearch.client
+ elasticsearch-rest-high-level-client
+ ${elasticsearch.version}
+
+
+
+
+
+
+ src/main/resources
+
+ **/*.txt
+ **/*.json
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ ${project.artifactId}
+ ${project.version}
+ ${maven.build.timestamp}
+ chen.ma
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.10.3
+
+
+
+ jar
+
+
+
+
+
+
+
diff --git a/hippo4j-monitor/hippo4j-monitor-es/src/main/java/cn/hippo4j/monitor/es/EsClientHolder.java b/hippo4j-monitor/hippo4j-monitor-es/src/main/java/cn/hippo4j/monitor/es/EsClientHolder.java
new file mode 100644
index 00000000..0d67adb2
--- /dev/null
+++ b/hippo4j-monitor/hippo4j-monitor-es/src/main/java/cn/hippo4j/monitor/es/EsClientHolder.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.hippo4j.monitor.es;
+
+import cn.hippo4j.common.config.ApplicationContextHolder;
+import com.google.common.base.Throwables;
+import com.google.common.collect.Lists;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.http.HttpHost;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.impl.client.BasicCredentialsProvider;
+import org.elasticsearch.client.RestClient;
+import org.elasticsearch.client.RestHighLevelClient;
+import org.elasticsearch.common.Strings;
+import org.springframework.core.env.Environment;
+
+import java.util.List;
+
+/**
+ * Create by yuyang
+ * 2022/8/4 16:26
+ */
+@Slf4j
+public class EsClientHolder {
+
+ private static String host;
+ private static String scheme;
+ private static String userName;
+ private static String password;
+
+ private static RestHighLevelClient client;
+
+ private static RestHighLevelClient initRestClient() {
+ try {
+ Environment environment = ApplicationContextHolder.getInstance().getEnvironment();
+ host = environment.getProperty("es.thread-pool-state.host");
+ scheme = environment.getProperty("es.thread-pool-state.schema");
+ userName = environment.getProperty("es.thread-pool-state.userName");
+ password = environment.getProperty("es.thread-pool-state.password");
+
+ List hosts = parseHosts();
+
+ if (Strings.isNullOrEmpty(userName) || Strings.isNullOrEmpty(password)) {
+ client = new RestHighLevelClient(RestClient.builder(hosts.toArray(new HttpHost[]{})));
+ } else {
+ client = new RestHighLevelClient(RestClient.builder(hosts.toArray(new HttpHost[]{}))
+ .setHttpClientConfigCallback(httpAsyncClientBuilder -> httpAsyncClientBuilder.setDefaultCredentialsProvider(getCredentialsProvider())));
+ }
+
+ log.info("[ES RestHighLevelClient] success to connect es!host:{},scheme:{}", host, scheme);
+ return client;
+ } catch (Exception ex) {
+ log.error("[ES RestHighLevelClient] fail to connect es! cause:{}", Throwables.getStackTraceAsString(ex));
+ }
+ return null;
+ }
+
+ private static BasicCredentialsProvider getCredentialsProvider() {
+ if (!Strings.isNullOrEmpty(userName) && !Strings.isNullOrEmpty(password)) {
+ final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
+ credentialsProvider.setCredentials(AuthScope.ANY,
+ new UsernamePasswordCredentials(userName, password));
+ return credentialsProvider;
+ }
+ return null;
+ }
+
+ public static RestHighLevelClient getClient() {
+ return null == client ? initRestClient() : client;
+ }
+
+ private static List parseHosts() {
+ String[] hostAndPorts = host.split(",");
+ List hosts = Lists.newArrayList();
+ for (String hostAndPort : hostAndPorts) {
+ hostAndPort = hostAndPort.trim();
+ hosts.add(new HttpHost(hostAndPort.split(":")[0], Integer.parseInt(hostAndPort.split(":")[1]), scheme));
+ }
+ return hosts;
+ }
+
+}
diff --git a/hippo4j-monitor/hippo4j-monitor-es/src/main/java/cn/hippo4j/monitor/es/EsMonitorHandler.java b/hippo4j-monitor/hippo4j-monitor-es/src/main/java/cn/hippo4j/monitor/es/EsMonitorHandler.java
new file mode 100644
index 00000000..6a668fb7
--- /dev/null
+++ b/hippo4j-monitor/hippo4j-monitor-es/src/main/java/cn/hippo4j/monitor/es/EsMonitorHandler.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.hippo4j.monitor.es;
+
+import cn.hippo4j.common.config.ApplicationContextHolder;
+import cn.hippo4j.common.model.ThreadPoolRunStateInfo;
+import cn.hippo4j.common.toolkit.JSONUtil;
+import cn.hippo4j.core.executor.state.ThreadPoolRunStateHandler;
+import cn.hippo4j.monitor.es.model.EsThreadPoolRunStateInfo;
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.io.FileUtil;
+import com.example.monitor.base.AbstractDynamicThreadPoolMonitor;
+import lombok.extern.slf4j.Slf4j;
+import org.elasticsearch.action.admin.indices.alias.Alias;
+import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
+import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
+import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
+import org.elasticsearch.action.index.IndexRequest;
+import org.elasticsearch.action.index.IndexResponse;
+import org.elasticsearch.client.RequestOptions;
+import org.elasticsearch.client.RestHighLevelClient;
+import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.xcontent.XContentType;
+import org.springframework.core.env.Environment;
+import org.springframework.util.StringUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.atomic.AtomicBoolean;
+@Slf4j
+public class EsMonitorHandler extends AbstractDynamicThreadPoolMonitor {
+
+ public EsMonitorHandler(ThreadPoolRunStateHandler threadPoolRunStateHandler) {
+ super(threadPoolRunStateHandler);
+ }
+
+ private AtomicBoolean isIndexExist = null;
+
+ @Override
+ protected void execute(ThreadPoolRunStateInfo poolRunStateInfo) {
+ EsThreadPoolRunStateInfo esThreadPoolRunStateInfo = new EsThreadPoolRunStateInfo();
+ BeanUtil.copyProperties(poolRunStateInfo, esThreadPoolRunStateInfo);
+
+ Environment environment = ApplicationContextHolder.getInstance().getEnvironment();
+ String indexName = environment.getProperty("es.thread-pool-state.index.name", "thread-pool-state");
+ String applicationName = environment.getProperty("spring.application.name", "application");
+
+ if (!this.isExists(indexName)) {
+ List rawMapping = FileUtil.readLines(new File(Thread.currentThread().getContextClassLoader().getResource("mapping.json").getPath()), StandardCharsets.UTF_8);
+ String mapping = String.join(" ", rawMapping);
+ // if index doesn't exsit, this function may try to create one, but recommend to create index manually.
+ this.createIndex(indexName, "_doc", mapping, null, null, null);
+ }
+
+ esThreadPoolRunStateInfo.setApplicationName(applicationName);
+ esThreadPoolRunStateInfo.setId(indexName + "-" + System.currentTimeMillis());
+ this.log2Es(esThreadPoolRunStateInfo, indexName);
+ }
+
+ public void log2Es(EsThreadPoolRunStateInfo esThreadPoolRunStateInfo, String indexName) {
+ RestHighLevelClient client = EsClientHolder.getClient();
+
+ try {
+ IndexRequest request = new IndexRequest(indexName, "_doc");
+ request.id(esThreadPoolRunStateInfo.getId());
+ String stateJson = JSONUtil.toJSONString(esThreadPoolRunStateInfo);
+ request.source(stateJson, XContentType.JSON);
+
+ IndexResponse response = client.index(request, RequestOptions.DEFAULT);
+ log.info("write thread-pool state to es, id is :{}", response.getId());
+ } catch (Exception ex) {
+ log.error("es index error, the exception was thrown in create index. name:{},type:{},id:{}. {} ",
+ indexName,
+ "_doc",
+ esThreadPoolRunStateInfo.getId(),
+ ex);
+ }
+ }
+
+ public synchronized boolean isExists(String index) {
+ // cache check result
+ if (Objects.isNull(isIndexExist)) {
+ boolean exists = false;
+ GetIndexRequest request = new GetIndexRequest();
+ request.indices(index);
+ try {
+ RestHighLevelClient client = EsClientHolder.getClient();
+ exists = client.indices().exists(request, RequestOptions.DEFAULT);
+ } catch (IOException e) {
+ log.error("check es index fail");
+ }
+ isIndexExist = new AtomicBoolean(exists);
+ }
+ return isIndexExist.get();
+ }
+
+ public void createIndex(String index, String type, String mapping, Integer shards, Integer replicas, String alias) {
+ RestHighLevelClient client = EsClientHolder.getClient();
+ boolean acknowledged = false;
+ CreateIndexRequest request = new CreateIndexRequest(index);
+ if (StringUtils.hasText(mapping)) {
+ request.mapping(type, mapping, XContentType.JSON);
+ }
+ if (!Objects.isNull(shards) && !Objects.isNull(replicas)) {
+ request.settings(Settings.builder()
+ .put("index.number_of_shards", shards) // 5
+ .put("index.number_of_replicas", replicas));// 1
+ }
+ if (StringUtils.hasText(alias)) {
+ request.alias(new Alias(alias));
+ }
+ try {
+ CreateIndexResponse createIndexResponse = client.indices().create(request, RequestOptions.DEFAULT);
+ acknowledged = createIndexResponse.isAcknowledged();
+ } catch (IOException e) {
+ log.error("create es index exception", e);
+ }
+ if (acknowledged) {
+ log.info("create es index success");
+ isIndexExist.set(true);
+ } else {
+ log.error("create es index fail");
+ throw new RuntimeException("cannot auto create thread-pool state es index");
+ }
+ }
+
+ @Override
+ public String getType() {
+ return "es";
+ }
+}
diff --git a/hippo4j-monitor/hippo4j-monitor-es/src/main/java/cn/hippo4j/monitor/es/model/EsThreadPoolRunStateInfo.java b/hippo4j-monitor/hippo4j-monitor-es/src/main/java/cn/hippo4j/monitor/es/model/EsThreadPoolRunStateInfo.java
new file mode 100644
index 00000000..3fc0deb7
--- /dev/null
+++ b/hippo4j-monitor/hippo4j-monitor-es/src/main/java/cn/hippo4j/monitor/es/model/EsThreadPoolRunStateInfo.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.hippo4j.monitor.es.model;
+
+import cn.hippo4j.common.model.ThreadPoolRunStateInfo;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * Create by yuyang
+ * 2022/8/4 17:17
+ */
+@Getter
+@Setter
+public class EsThreadPoolRunStateInfo extends ThreadPoolRunStateInfo {
+
+ private String Id;
+
+ private String applicationName;
+
+}
diff --git a/hippo4j-monitor/hippo4j-monitor-es/src/main/resources/mapping.json b/hippo4j-monitor/hippo4j-monitor-es/src/main/resources/mapping.json
new file mode 100644
index 00000000..83255022
--- /dev/null
+++ b/hippo4j-monitor/hippo4j-monitor-es/src/main/resources/mapping.json
@@ -0,0 +1,78 @@
+ {
+ "_doc": {
+ "properties": {
+ "activeSize": {
+ "type": "long"
+ },
+ "applicationName": {
+ "type": "keyword"
+ },
+ "clientLastRefreshTime": {
+ "type": "text"
+ },
+ "completedTaskCount": {
+ "type": "long"
+ },
+ "coreSize": {
+ "type": "long"
+ },
+ "currentLoad": {
+ "type": "text"
+ },
+ "freeMemory": {
+ "type": "text"
+ },
+ "host": {
+ "type": "keyword"
+ },
+ "id": {
+ "type": "text"
+ },
+ "largestPoolSize": {
+ "type": "long"
+ },
+ "maximumSize": {
+ "type": "long"
+ },
+ "memoryProportion": {
+ "type": "text"
+ },
+ "peakLoad": {
+ "type": "text"
+ },
+ "poolSize": {
+ "type": "long"
+ },
+ "queueCapacity": {
+ "type": "long"
+ },
+ "queueRemainingCapacity": {
+ "type": "long"
+ },
+ "queueSize": {
+ "type": "long"
+ },
+ "queueType": {
+ "type": "text"
+ },
+ "rejectCount": {
+ "type": "long"
+ },
+ "rejectedName": {
+ "type": "text"
+ },
+ "simpleCurrentLoad": {
+ "type": "long"
+ },
+ "simplePeakLoad": {
+ "type": "long"
+ },
+ "timestamp": {
+ "type": "date"
+ },
+ "tpId": {
+ "type": "keyword"
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/hippo4j-monitor/pom.xml b/hippo4j-monitor/pom.xml
index 386cbaf2..9af67ac1 100644
--- a/hippo4j-monitor/pom.xml
+++ b/hippo4j-monitor/pom.xml
@@ -14,6 +14,7 @@
hippo4j-monitor-base
hippo4j-monitor-log
hippo4j-monitor-prometheus
+ hippo4j-monitor-es
diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/pom.xml b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/pom.xml
index b0413e06..7056e02a 100644
--- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/pom.xml
+++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/pom.xml
@@ -83,6 +83,12 @@
hippo4j-monitor-prometheus
${revision}
+
+
+ cn.hippo4j
+ hippo4j-monitor-es
+ ${revision}
+
diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/DynamicThreadPoolCoreAutoConfiguration.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/DynamicThreadPoolCoreAutoConfiguration.java
index 28b90b38..c616c9c2 100644
--- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/DynamicThreadPoolCoreAutoConfiguration.java
+++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/DynamicThreadPoolCoreAutoConfiguration.java
@@ -59,7 +59,8 @@ import org.springframework.core.annotation.Order;
@Import({
ConfigHandlerConfiguration.EmbeddedNacos.class, ConfigHandlerConfiguration.EmbeddedNacosCloud.class,
ConfigHandlerConfiguration.EmbeddedApollo.class, ConfigHandlerConfiguration.EmbeddedZookeeper.class,
- MonitorHandlerConfiguration.EmbeddedLogMonitor.class, MonitorHandlerConfiguration.EmbeddedPrometheusMonitor.class
+ MonitorHandlerConfiguration.EmbeddedLogMonitor.class, MonitorHandlerConfiguration.EmbeddedPrometheusMonitor.class,
+ MonitorHandlerConfiguration.EmbeddedEsMonitor.class
})
public class DynamicThreadPoolCoreAutoConfiguration {
diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/MonitorHandlerConfiguration.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/MonitorHandlerConfiguration.java
index 28f0b77b..09ab75db 100644
--- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/MonitorHandlerConfiguration.java
+++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/MonitorHandlerConfiguration.java
@@ -18,8 +18,10 @@
package cn.hippo4j.core.springboot.starter.config;
import cn.hippo4j.core.executor.state.ThreadPoolRunStateHandler;
+import cn.hippo4j.core.springboot.starter.config.condition.EsMonitorCondition;
import cn.hippo4j.core.springboot.starter.config.condition.LogMonitorCondition;
import cn.hippo4j.core.springboot.starter.config.condition.PrometheusMonitorCondition;
+import cn.hippo4j.monitor.es.EsMonitorHandler;
import cn.hippo4j.monitor.log.LogMonitorHandler;
import cn.hippo4j.monitor.prometheus.PrometheusMonitorHandler;
import org.springframework.context.annotation.Bean;
@@ -49,4 +51,13 @@ public class MonitorHandlerConfiguration {
return new PrometheusMonitorHandler(threadPoolRunStateHandler);
}
}
+
+ @Conditional(EsMonitorCondition.class)
+ static class EmbeddedEsMonitor {
+
+ @Bean
+ public EsMonitorHandler EsMonitorHandler(ThreadPoolRunStateHandler threadPoolRunStateHandler) {
+ return new EsMonitorHandler(threadPoolRunStateHandler);
+ }
+ }
}
diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/condition/EsMonitorCondition.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/condition/EsMonitorCondition.java
new file mode 100644
index 00000000..ee791f44
--- /dev/null
+++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/condition/EsMonitorCondition.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.hippo4j.core.springboot.starter.config.condition;
+
+import cn.hippo4j.common.toolkit.StringUtil;
+import cn.hippo4j.core.springboot.starter.config.BootstrapCoreProperties;
+import com.example.monitor.base.MonitorTypeEnum;
+import org.springframework.context.annotation.Condition;
+import org.springframework.context.annotation.ConditionContext;
+import org.springframework.core.type.AnnotatedTypeMetadata;
+
+/**
+ * Prometheus monitor condition.
+ */
+public class EsMonitorCondition implements Condition {
+
+ @Override
+ public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
+ String collectType = context.getEnvironment().getProperty(BootstrapCoreProperties.PREFIX + ".collect-type", "");
+ return StringUtil.isNotEmpty(collectType) && collectType.contains(MonitorTypeEnum.ES.name().toLowerCase()) ? true : false;
+ }
+}
diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/pom.xml b/hippo4j-spring-boot/hippo4j-spring-boot-starter/pom.xml
index 4c97def7..8996ff47 100644
--- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/pom.xml
+++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/pom.xml
@@ -102,6 +102,12 @@
hippo4j-monitor-prometheus
${revision}
+
+
+ cn.hippo4j
+ hippo4j-monitor-es
+ ${revision}
+
diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/monitor/ReportingEventExecutor.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/monitor/ReportingEventExecutor.java
index acc4fd89..0a9a4632 100644
--- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/monitor/ReportingEventExecutor.java
+++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/monitor/ReportingEventExecutor.java
@@ -112,7 +112,8 @@ public class ReportingEventExecutor implements Runnable, CommandLineRunner, Disp
new Integer(collectType.split(",").length),
ThreadFactoryBuilder.builder().daemon(true).prefix("client.scheduled.collect.data").build());
if (collectType.contains(MonitorTypeEnum.PROMETHEUS.name().toLowerCase())
- || collectType.contains(MonitorTypeEnum.LOG.name().toLowerCase())) {
+ || collectType.contains(MonitorTypeEnum.LOG.name().toLowerCase())
+ || collectType.contains(MonitorTypeEnum.ES.name().toLowerCase())) {
// Get all dynamic thread pool monitoring components.
threadPoolMonitors = ApplicationContextHolder.getBeansOfType(ThreadPoolMonitor.class);
collectVesselExecutor.scheduleWithFixedDelay(
diff --git a/pom.xml b/pom.xml
index b4c2dbf8..3b771897 100644
--- a/pom.xml
+++ b/pom.xml
@@ -57,6 +57,7 @@
2.2.6.RELEASE
2.2.9.RELEASE
2.2.5.RELEASE
+ 6.5.0
1.8