add: 线程、tomcat监控
This commit is contained in:
@@ -31,6 +31,11 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.dromara.dynamictp</groupId>
|
||||
<artifactId>dynamic-tp-spring-boot-starter-adapter-webserver</artifactId>
|
||||
<version>1.1.6.1</version>
|
||||
</dependency>
|
||||
<!-- 日志链路追踪 https://tlog.yomahub.com/pages/f62a84/#%E5%90%8C%E6%AD%A5%E6%97%A5%E5%BF%97-->
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl;
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
|
||||
import com.alicp.jetcache.anno.config.EnableMethodCache;
|
||||
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -23,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@EnableAsync
|
||||
@RestController
|
||||
@EnableDynamicTp
|
||||
@SpringBootApplication(exclude = {
|
||||
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
|
||||
})
|
||||
|
||||
@@ -16,7 +16,12 @@
|
||||
package org.nl.config.thread;
|
||||
|
||||
|
||||
import org.dromara.dynamictp.core.support.DynamicTp;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
@@ -28,16 +33,22 @@ import java.util.concurrent.TimeUnit;
|
||||
* @author Zheng Jie
|
||||
* @date 2019年10月31日18:16:47
|
||||
*/
|
||||
@Configuration
|
||||
public class ThreadPoolExecutorUtil {
|
||||
|
||||
public static ThreadPoolExecutor getPoll() {
|
||||
AsyncTaskProperties properties = SpringContextHolder.getBean(AsyncTaskProperties.class);
|
||||
@Autowired
|
||||
private AsyncTaskProperties asyncTaskProperties;
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
@DynamicTp("el-thread")
|
||||
public ThreadPoolExecutor threadPoolExecutor() {
|
||||
return new ThreadPoolExecutor(
|
||||
properties.getCorePoolSize(),
|
||||
properties.getMaxPoolSize(),
|
||||
properties.getKeepAliveSeconds(),
|
||||
asyncTaskProperties.getCorePoolSize(),
|
||||
asyncTaskProperties.getMaxPoolSize(),
|
||||
asyncTaskProperties.getKeepAliveSeconds(),
|
||||
TimeUnit.SECONDS,
|
||||
new ArrayBlockingQueue<>(properties.getQueueCapacity()),
|
||||
new ArrayBlockingQueue<>(asyncTaskProperties.getQueueCapacity()),
|
||||
new TheadFactoryName()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ import org.nl.system.service.quartz.impl.SysQuartzJobServiceImpl;
|
||||
import org.quartz.DisallowConcurrentExecution;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
@@ -35,7 +37,9 @@ public class ExecutionJob extends TLogQuartzJobBean {
|
||||
/**
|
||||
* 该处仅供参考
|
||||
*/
|
||||
private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll();
|
||||
@Autowired
|
||||
@Qualifier("threadPoolExecutor")
|
||||
private ThreadPoolExecutor EXECUTOR;
|
||||
|
||||
@Override
|
||||
public void executeTask(JobExecutionContext context) throws JobExecutionException {
|
||||
|
||||
@@ -13,7 +13,45 @@ spring:
|
||||
redis:
|
||||
repositories:
|
||||
enabled: false
|
||||
dynamic:
|
||||
tp:
|
||||
enabled: true # 是否启用 dynamictp,默认true
|
||||
enabledBanner: false # 是否启用 控制台banner,默认true
|
||||
enabledCollect: true # 是否开启监控指标采集,默认true
|
||||
collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer
|
||||
logPath: C:\log\lms # 监控日志数据路径,默认 ${user.home}/logs,采集类型非logging不用配置
|
||||
monitorInterval: 8
|
||||
tomcatTp: # tomcat webserver 线程池配置
|
||||
threadPoolAliasName: tomcat 线程池 # 线程池别名,可选
|
||||
corePoolSize: 100
|
||||
maximumPoolSize: 200
|
||||
keepAliveTime: 60
|
||||
runTimeout: 10000
|
||||
queueTimeout: 100
|
||||
notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警)
|
||||
- type: change
|
||||
enabled: true
|
||||
|
||||
- type: capacity # 队列容量使用率,报警项类型,查看源码 NotifyTypeEnum枚举类
|
||||
enabled: true
|
||||
threshold: 80 # 报警阈值,默认70,意思是队列使用率达到70%告警
|
||||
interval: 120 # 报警间隔(单位:s),默认120
|
||||
|
||||
- type: liveness # 线程池活性
|
||||
enabled: true
|
||||
threshold: 80 # 报警阈值,默认 70,意思是活性达到70%告警
|
||||
|
||||
- type: reject # 触发任务拒绝告警
|
||||
enabled: true
|
||||
threshold: 100 # 默认阈值10
|
||||
|
||||
- type: run_timeout # 任务执行超时告警
|
||||
enabled: true
|
||||
threshold: 100 # 默认阈值10
|
||||
|
||||
- type: queue_timeout # 任务排队超时告警
|
||||
enabled: true
|
||||
threshold: 100 # 默认阈值10
|
||||
#配置 Jpa
|
||||
jpa:
|
||||
hibernate:
|
||||
|
||||
Reference in New Issue
Block a user