Browse Source

move monitor

AE86 1 year ago
parent
commit
ed1b8c641c
27 changed files with 630 additions and 716 deletions
  1. 0 7
      dbsyncer-biz/pom.xml
  2. 2 2
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/MonitorService.java
  3. 1 1
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/enums/BufferActuatorMetricEnum.java
  4. 48 48
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/enums/DiskMetricEnum.java
  5. 81 81
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/enums/MetricEnum.java
  6. 54 54
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/enums/StatisticEnum.java
  7. 1 1
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/enums/ThreadPoolMetricEnum.java
  8. 243 250
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/impl/MetricReporter.java
  9. 10 10
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/impl/MonitorServiceImpl.java
  10. 1 1
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/metric/impl/CpuMetricDetailFormatter.java
  11. 1 1
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/metric/impl/DiskMetricDetailFormatter.java
  12. 1 1
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/metric/impl/DoubleRoundMetricDetailFormatter.java
  13. 1 1
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/metric/impl/GCMetricDetailFormatter.java
  14. 1 1
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/metric/impl/MemoryMetricDetailFormatter.java
  15. 1 1
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/metric/impl/ValueMetricDetailFormatter.java
  16. 1 1
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/model/AppReportMetric.java
  17. 69 69
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/model/MappingReportMetric.java
  18. 55 55
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/model/MetricResponse.java
  19. 23 23
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/model/MetricResponseInfo.java
  20. 28 28
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/model/Sample.java
  21. 1 1
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/vo/AppReportMetricVo.java
  22. 1 1
      dbsyncer-biz/src/main/java/org/dbsyncer/biz/vo/MetricResponseVo.java
  23. 0 22
      dbsyncer-monitor/pom.xml
  24. 0 22
      dbsyncer-monitor/src/main/java/org/dbsyncer/monitor/Monitor.java
  25. 0 27
      dbsyncer-monitor/src/main/java/org/dbsyncer/monitor/MonitorException.java
  26. 5 5
      dbsyncer-web/src/main/java/org/dbsyncer/web/controller/monitor/MonitorController.java
  27. 1 2
      pom.xml

+ 0 - 7
dbsyncer-biz/pom.xml

@@ -18,12 +18,5 @@
 			<version>${project.parent.version}</version>
 		</dependency>
 
-		<!-- Monitor 监控服务 -->
-		<dependency>
-			<groupId>org.ghi</groupId>
-			<artifactId>dbsyncer-monitor</artifactId>
-			<version>${project.parent.version}</version>
-		</dependency>
-
 	</dependencies>
 </project>

+ 2 - 2
dbsyncer-biz/src/main/java/org/dbsyncer/biz/MonitorService.java

@@ -3,8 +3,8 @@ package org.dbsyncer.biz;
 import org.dbsyncer.biz.vo.AppReportMetricVo;
 import org.dbsyncer.biz.vo.MetaVo;
 import org.dbsyncer.common.model.Paging;
-import org.dbsyncer.monitor.enums.MetricEnum;
-import org.dbsyncer.monitor.model.MetricResponse;
+import org.dbsyncer.biz.enums.MetricEnum;
+import org.dbsyncer.biz.model.MetricResponse;
 import org.dbsyncer.storage.enums.StorageDataStatusEnum;
 
 import java.util.List;

+ 1 - 1
dbsyncer-monitor/src/main/java/org/dbsyncer/monitor/enums/BufferActuatorMetricEnum.java → dbsyncer-biz/src/main/java/org/dbsyncer/biz/enums/BufferActuatorMetricEnum.java

@@ -1,4 +1,4 @@
-package org.dbsyncer.monitor.enums;
+package org.dbsyncer.biz.enums;
 
 /**
  * 缓存执行器指标

+ 48 - 48
dbsyncer-monitor/src/main/java/org/dbsyncer/monitor/enums/DiskMetricEnum.java → dbsyncer-biz/src/main/java/org/dbsyncer/biz/enums/DiskMetricEnum.java

@@ -1,48 +1,48 @@
-package org.dbsyncer.monitor.enums;
-
-/**
- * 硬盘指标
- *
- * @author AE86
- * @version 1.0.0
- * @date 2021/07/23 0:19
- */
-public enum DiskMetricEnum {
-
-    /**
-     * 已用
-     */
-    THRESHOLD("disk.space.threshold", "硬盘", "已用"),
-
-    /**
-     * 空闲
-     */
-    FREE("disk.space.free", "硬盘", "空闲"),
-    
-    /**
-     * 总共
-     */
-    TOTAL("disk.space.total", "硬盘", "总共"),;
-
-    private String code;
-    private String group;
-    private String metricName;
-
-    DiskMetricEnum(String code, String group, String metricName) {
-        this.code = code;
-        this.group = group;
-        this.metricName = metricName;
-    }
-
-    public String getCode() {
-        return code;
-    }
-
-    public String getGroup() {
-        return group;
-    }
-
-    public String getMetricName() {
-        return metricName;
-    }
-}
+package org.dbsyncer.biz.enums;
+
+/**
+ * 硬盘指标
+ *
+ * @author AE86
+ * @version 1.0.0
+ * @date 2021/07/23 0:19
+ */
+public enum DiskMetricEnum {
+
+    /**
+     * 已用
+     */
+    THRESHOLD("disk.space.threshold", "硬盘", "已用"),
+
+    /**
+     * 空闲
+     */
+    FREE("disk.space.free", "硬盘", "空闲"),
+    
+    /**
+     * 总共
+     */
+    TOTAL("disk.space.total", "硬盘", "总共"),;
+
+    private String code;
+    private String group;
+    private String metricName;
+
+    DiskMetricEnum(String code, String group, String metricName) {
+        this.code = code;
+        this.group = group;
+        this.metricName = metricName;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getGroup() {
+        return group;
+    }
+
+    public String getMetricName() {
+        return metricName;
+    }
+}

+ 81 - 81
dbsyncer-monitor/src/main/java/org/dbsyncer/monitor/enums/MetricEnum.java → dbsyncer-biz/src/main/java/org/dbsyncer/biz/enums/MetricEnum.java

@@ -1,82 +1,82 @@
-package org.dbsyncer.monitor.enums;
-
-import org.dbsyncer.common.util.StringUtil;
-import org.dbsyncer.connector.ConnectorException;
-import org.dbsyncer.monitor.MonitorException;
-
-/**
- * 系统指标
- *
- * @author AE86
- * @version 1.0.0
- * @date 2021/07/22 19:19
- */
-public enum MetricEnum {
-
-    /**
-     * 线程活跃数
-     */
-    THREADS_LIVE("jvm.threads.live", "应用线程", "活跃数"),
-
-    /**
-     * 线程峰值
-     */
-    THREADS_PEAK("jvm.threads.peak", "应用线程", "峰值数"),
-
-    /**
-     * 内存已用
-     */
-    MEMORY_USED("jvm.memory.used", "内存", "已用"),
-
-    /**
-     * 内存空闲
-     */
-    MEMORY_COMMITTED("jvm.memory.committed", "内存", "空闲"),
-
-    /**
-     * 内存总共
-     */
-    MEMORY_MAX("jvm.memory.max", "内存", "总共"),
-
-    /**
-     * GC
-     */
-    GC_PAUSE("jvm.gc.pause", "GC", "已用"),
-
-    /**
-     * CPU已用
-     */
-    CPU_USAGE("system.cpu.usage", "CPU", "已用");
-
-    private String code;
-    private String group;
-    private String metricName;
-
-    MetricEnum(String code, String group, String metricName) {
-        this.code = code;
-        this.group = group;
-        this.metricName = metricName;
-    }
-
-    public static MetricEnum getMetric(String code) throws ConnectorException {
-        for (MetricEnum e : MetricEnum.values()) {
-            if (StringUtil.equals(code, e.getCode())) {
-                return e;
-            }
-        }
-        throw new MonitorException(String.format("Metric code \"%s\" does not exist.", code));
-    }
-
-    public String getCode() {
-        return code;
-    }
-
-    public String getGroup() {
-        return group;
-    }
-
-    public String getMetricName() {
-        return metricName;
-    }
-
+package org.dbsyncer.biz.enums;
+
+import org.dbsyncer.biz.BizException;
+import org.dbsyncer.common.util.StringUtil;
+import org.dbsyncer.connector.ConnectorException;
+
+/**
+ * 系统指标
+ *
+ * @author AE86
+ * @version 1.0.0
+ * @date 2021/07/22 19:19
+ */
+public enum MetricEnum {
+
+    /**
+     * 线程活跃数
+     */
+    THREADS_LIVE("jvm.threads.live", "应用线程", "活跃数"),
+
+    /**
+     * 线程峰值
+     */
+    THREADS_PEAK("jvm.threads.peak", "应用线程", "峰值数"),
+
+    /**
+     * 内存已用
+     */
+    MEMORY_USED("jvm.memory.used", "内存", "已用"),
+
+    /**
+     * 内存空闲
+     */
+    MEMORY_COMMITTED("jvm.memory.committed", "内存", "空闲"),
+
+    /**
+     * 内存总共
+     */
+    MEMORY_MAX("jvm.memory.max", "内存", "总共"),
+
+    /**
+     * GC
+     */
+    GC_PAUSE("jvm.gc.pause", "GC", "已用"),
+
+    /**
+     * CPU已用
+     */
+    CPU_USAGE("system.cpu.usage", "CPU", "已用");
+
+    private String code;
+    private String group;
+    private String metricName;
+
+    MetricEnum(String code, String group, String metricName) {
+        this.code = code;
+        this.group = group;
+        this.metricName = metricName;
+    }
+
+    public static MetricEnum getMetric(String code) throws ConnectorException {
+        for (MetricEnum e : MetricEnum.values()) {
+            if (StringUtil.equals(code, e.getCode())) {
+                return e;
+            }
+        }
+        throw new BizException(String.format("Metric code \"%s\" does not exist.", code));
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getGroup() {
+        return group;
+    }
+
+    public String getMetricName() {
+        return metricName;
+    }
+
 }

+ 54 - 54
dbsyncer-monitor/src/main/java/org/dbsyncer/monitor/enums/StatisticEnum.java → dbsyncer-biz/src/main/java/org/dbsyncer/biz/enums/StatisticEnum.java

@@ -1,55 +1,55 @@
-package org.dbsyncer.monitor.enums;
-
-public enum StatisticEnum {
-
-    /**
-     * The sum of the amounts recorded.
-     */
-    TOTAL("total"),
-
-    /**
-     * The sum of the times recorded. Reported in the monitoring system's base unit of time
-     */
-    TOTAL_TIME("total"),
-
-    /**
-     * Rate per second for calls.
-     */
-    COUNT("count"),
-
-    /**
-     * The maximum amount recorded. When this represents a time, it is reported in the monitoring system's base unit of time.
-     */
-    MAX("max"),
-
-    /**
-     * Instantaneous value, such as those reported by gauges.
-     */
-    VALUE("value"),
-
-    /**
-     * Undetermined.
-     */
-    UNKNOWN("unknown"),
-
-    /**
-     * Number of currently active tasks for a long task timer.
-     */
-    ACTIVE_TASKS("active"),
-
-    /**
-     * Duration of a running task in a long task timer. Always reported in the monitoring system's base unit of time.
-     */
-    DURATION("duration");
-
-    private String tagValueRepresentation;
-
-    StatisticEnum(String tagValueRepresentation) {
-        this.tagValueRepresentation = tagValueRepresentation;
-    }
-
-    public String getTagValueRepresentation() {
-        return tagValueRepresentation;
-    }
-
+package org.dbsyncer.biz.enums;
+
+public enum StatisticEnum {
+
+    /**
+     * The sum of the amounts recorded.
+     */
+    TOTAL("total"),
+
+    /**
+     * The sum of the times recorded. Reported in the monitoring system's base unit of time
+     */
+    TOTAL_TIME("total"),
+
+    /**
+     * Rate per second for calls.
+     */
+    COUNT("count"),
+
+    /**
+     * The maximum amount recorded. When this represents a time, it is reported in the monitoring system's base unit of time.
+     */
+    MAX("max"),
+
+    /**
+     * Instantaneous value, such as those reported by gauges.
+     */
+    VALUE("value"),
+
+    /**
+     * Undetermined.
+     */
+    UNKNOWN("unknown"),
+
+    /**
+     * Number of currently active tasks for a long task timer.
+     */
+    ACTIVE_TASKS("active"),
+
+    /**
+     * Duration of a running task in a long task timer. Always reported in the monitoring system's base unit of time.
+     */
+    DURATION("duration");
+
+    private String tagValueRepresentation;
+
+    StatisticEnum(String tagValueRepresentation) {
+        this.tagValueRepresentation = tagValueRepresentation;
+    }
+
+    public String getTagValueRepresentation() {
+        return tagValueRepresentation;
+    }
+
 }

+ 1 - 1
dbsyncer-monitor/src/main/java/org/dbsyncer/monitor/enums/ThreadPoolMetricEnum.java → dbsyncer-biz/src/main/java/org/dbsyncer/biz/enums/ThreadPoolMetricEnum.java

@@ -1,4 +1,4 @@
-package org.dbsyncer.monitor.enums;
+package org.dbsyncer.biz.enums;
 
 /**
  * 线程池指标

+ 243 - 250
dbsyncer-monitor/src/main/java/org/dbsyncer/monitor/MonitorFactory.java → dbsyncer-biz/src/main/java/org/dbsyncer/biz/impl/MetricReporter.java

@@ -1,251 +1,244 @@
-package org.dbsyncer.monitor;
-
-import org.dbsyncer.common.model.Paging;
-import org.dbsyncer.common.scheduled.ScheduledTaskJob;
-import org.dbsyncer.common.scheduled.ScheduledTaskService;
-import org.dbsyncer.common.util.CollectionUtils;
-import org.dbsyncer.common.util.StringUtil;
-import org.dbsyncer.connector.constant.ConnectorConstant;
-import org.dbsyncer.monitor.enums.BufferActuatorMetricEnum;
-import org.dbsyncer.monitor.enums.MetricEnum;
-import org.dbsyncer.monitor.enums.StatisticEnum;
-import org.dbsyncer.monitor.enums.ThreadPoolMetricEnum;
-import org.dbsyncer.monitor.model.AppReportMetric;
-import org.dbsyncer.monitor.model.MappingReportMetric;
-import org.dbsyncer.monitor.model.MetricResponse;
-import org.dbsyncer.monitor.model.MetricResponseInfo;
-import org.dbsyncer.monitor.model.Sample;
-import org.dbsyncer.parser.ProfileComponent;
-import org.dbsyncer.parser.flush.BufferActuator;
-import org.dbsyncer.parser.flush.impl.BufferActuatorRouter;
-import org.dbsyncer.parser.flush.impl.TableGroupBufferActuator;
-import org.dbsyncer.parser.model.Mapping;
-import org.dbsyncer.parser.model.Meta;
-import org.dbsyncer.parser.model.TableGroup;
-import org.dbsyncer.storage.StorageService;
-import org.dbsyncer.storage.constant.ConfigConstant;
-import org.dbsyncer.storage.enums.StorageDataStatusEnum;
-import org.dbsyncer.storage.enums.StorageEnum;
-import org.dbsyncer.storage.query.Query;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.Resource;
-import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.function.Consumer;
-import java.util.stream.Collectors;
-
-/**
- * @author AE86
- * @version 1.0.0
- * @date 2020/04/23 11:30
- */
-@Component
-public class MonitorFactory implements Monitor, ScheduledTaskJob {
-
-    private final Logger logger = LoggerFactory.getLogger(getClass());
-
-    @Resource
-    private ProfileComponent profileComponent;
-
-    @Resource
-    private BufferActuator generalBufferActuator;
-
-    @Resource
-    private BufferActuator storageBufferActuator;
-
-    @Resource
-    private BufferActuatorRouter bufferActuatorRouter;
-
-    @Resource
-    private ScheduledTaskService scheduledTaskService;
-
-    @Resource
-    private StorageService storageService;
-
-    private volatile boolean running;
-
-    private LocalDateTime queryTime;
-
-    private final MappingReportMetric mappingReportMetric = new MappingReportMetric();
-
-    private final int SHOW_BUFFER_ACTUATOR_SIZE = 6;
-
-    @PostConstruct
-    private void init() {
-        scheduledTaskService.start(5000, this);
-    }
-
-    @Override
-    public List<MetricEnum> getMetricEnumAll() {
-        return Arrays.asList(MetricEnum.values());
-    }
-
-    @Override
-    public List<MetricResponse> getMetricInfo() {
-        List<MetricResponseInfo> list = new ArrayList<>();
-        BufferActuatorMetricEnum general = BufferActuatorMetricEnum.GENERAL;
-        BufferActuatorMetricEnum storage = BufferActuatorMetricEnum.STORAGE;
-        list.add(collect(generalBufferActuator, general.getCode(), general.getGroup(), general.getMetricName()));
-        list.add(collect(storageBufferActuator, storage.getCode(), storage.getGroup(), storage.getMetricName()));
-        if (!CollectionUtils.isEmpty(bufferActuatorRouter.getRouter())) {
-            List<MetricResponseInfo> tableList = new ArrayList<>();
-            String tableGroupCode = BufferActuatorMetricEnum.TABLE_GROUP.getCode();
-            bufferActuatorRouter.getRouter().forEach((metaId, group) -> {
-                Meta meta = profileComponent.getMeta(metaId);
-                Mapping mapping = profileComponent.getMapping(meta.getMappingId());
-                group.forEach((k, bufferActuator) -> {
-                    if (bufferActuator instanceof TableGroupBufferActuator) {
-                        TableGroupBufferActuator actuator = bufferActuator;
-                        TableGroup tableGroup = profileComponent.getTableGroup(actuator.getTableGroupId());
-                        String metricName = new StringBuilder()
-                                .append(tableGroup.getSourceTable().getName())
-                                .append(" > ")
-                                .append(tableGroup.getTargetTable().getName()).toString();
-                        tableList.add(collect(bufferActuator, tableGroupCode, mapping.getName(), metricName));
-                    }
-                });
-            });
-            List<MetricResponseInfo> sortList = tableList.stream()
-                    .sorted(Comparator.comparing(MetricResponseInfo::getQueueUp).reversed())
-                    .collect(Collectors.toList());
-            list.addAll(sortList.size() <= SHOW_BUFFER_ACTUATOR_SIZE ? sortList : sortList.subList(0, SHOW_BUFFER_ACTUATOR_SIZE));
-        }
-        return list.stream().map(info -> info.getResponse()).collect(Collectors.toList());
-    }
-
-    @Override
-    public AppReportMetric getAppReportMetric() {
-        queryTime = LocalDateTime.now();
-        AppReportMetric report = new AppReportMetric();
-        report.setSuccess(mappingReportMetric.getSuccess());
-        report.setFail(mappingReportMetric.getFail());
-        report.setInsert(mappingReportMetric.getInsert());
-        report.setUpdate(mappingReportMetric.getUpdate());
-        report.setDelete(mappingReportMetric.getDelete());
-        // 堆积任务(通用执行器 + 表执行器)
-        report.setQueueUp(bufferActuatorRouter.getQueueSize().addAndGet(generalBufferActuator.getQueue().size()));
-        report.setQueueCapacity(bufferActuatorRouter.getQueueCapacity().addAndGet(generalBufferActuator.getQueueCapacity()));
-        // 持久化任务
-        report.setStorageQueueUp(storageBufferActuator.getQueue().size());
-        report.setStorageQueueCapacity(storageBufferActuator.getQueueCapacity());
-        return report;
-    }
-
-    @Override
-    public void run() {
-        if (running || null == queryTime) {
-            return;
-        }
-        // 非活动时间范围(30s内)
-        if (LocalDateTime.now().minusSeconds(30).isAfter(queryTime)) {
-            return;
-        }
-
-        // 刷新报表
-        try {
-            running = true;
-            final List<Meta> metaAll = profileComponent.getMetaAll();
-            mappingReportMetric.setSuccess(getMappingSuccess(metaAll));
-            mappingReportMetric.setFail(getMappingFail(metaAll));
-            mappingReportMetric.setInsert(getMappingInsert(metaAll));
-            mappingReportMetric.setUpdate(getMappingUpdate(metaAll));
-            mappingReportMetric.setDelete(getMappingDelete(metaAll));
-        } catch (Exception e) {
-            logger.error(e.getMessage());
-        } finally {
-            running = false;
-        }
-    }
-
-    /**
-     * 获取所有驱动成功数
-     *
-     * @param metaAll
-     * @return
-     */
-    private long getMappingSuccess(List<Meta> metaAll) {
-        return queryMappingMetricCount(metaAll, (query) -> query.addFilter(ConfigConstant.DATA_SUCCESS, StorageDataStatusEnum.SUCCESS.getValue()));
-    }
-
-    /**
-     * 获取所有驱动失败数
-     *
-     * @param metaAll
-     * @return
-     */
-    private long getMappingFail(List<Meta> metaAll) {
-        return queryMappingMetricCount(metaAll, (query) -> query.addFilter(ConfigConstant.DATA_SUCCESS, StorageDataStatusEnum.FAIL.getValue()));
-    }
-
-    /**
-     * 获取所有驱动事件插入数
-     *
-     * @param metaAll
-     * @return
-     */
-    private long getMappingInsert(List<Meta> metaAll) {
-        return queryMappingMetricCount(metaAll, (query) -> query.addFilter(ConfigConstant.DATA_EVENT, ConnectorConstant.OPERTION_INSERT));
-    }
-
-    /**
-     * 获取所有驱动事件更新数
-     *
-     * @param metaAll
-     * @return
-     */
-    private long getMappingUpdate(List<Meta> metaAll) {
-        return queryMappingMetricCount(metaAll, (query) -> query.addFilter(ConfigConstant.DATA_EVENT, ConnectorConstant.OPERTION_UPDATE));
-    }
-
-    /**
-     * 获取所有驱动事件删除数
-     *
-     * @param metaAll
-     * @return
-     */
-    private long getMappingDelete(List<Meta> metaAll) {
-        return queryMappingMetricCount(metaAll, (query) -> query.addFilter(ConfigConstant.DATA_EVENT, ConnectorConstant.OPERTION_DELETE));
-    }
-
-    private long queryMappingMetricCount(List<Meta> metaAll, Consumer<Query> operation) {
-        AtomicLong total = new AtomicLong(0);
-        if (!CollectionUtils.isEmpty(metaAll)) {
-            Query query = new Query(1, 1);
-            query.setQueryTotal(true);
-            query.setType(StorageEnum.DATA);
-            operation.accept(query);
-            metaAll.forEach(meta -> {
-                query.setMetaId(meta.getId());
-                Paging paging = storageService.query(query);
-                total.getAndAdd(paging.getTotal());
-            });
-        }
-        return total.get();
-    }
-
-    private MetricResponseInfo collect(BufferActuator bufferActuator, String code, String group, String metricName) {
-        MetricResponseInfo info = new MetricResponseInfo();
-        ThreadPoolTaskExecutor threadTask = (ThreadPoolTaskExecutor) bufferActuator.getExecutor();
-        ThreadPoolExecutor pool = threadTask.getThreadPoolExecutor();
-        info.setQueueUp(bufferActuator.getQueue().size());
-        StringBuilder msg = new StringBuilder();
-        msg.append("堆积").append(StringUtil.COLON).append(info.getQueueUp());
-        msg.append(StringUtil.FORWARD_SLASH).append(bufferActuator.getQueueCapacity()).append(StringUtil.SPACE);
-        msg.append(ThreadPoolMetricEnum.CORE_SIZE.getMetricName()).append(StringUtil.COLON).append(pool.getActiveCount());
-        msg.append(StringUtil.FORWARD_SLASH).append(pool.getCorePoolSize()).append(StringUtil.SPACE);
-        msg.append(ThreadPoolMetricEnum.COMPLETED.getMetricName()).append(StringUtil.COLON).append(pool.getCompletedTaskCount());
-        info.setResponse(new MetricResponse(code, group, metricName, Arrays.asList(new Sample(StatisticEnum.COUNT.getTagValueRepresentation(), msg.toString()))));
-        return info;
-    }
-
+package org.dbsyncer.biz.impl;
+
+import org.dbsyncer.biz.enums.BufferActuatorMetricEnum;
+import org.dbsyncer.biz.enums.MetricEnum;
+import org.dbsyncer.biz.enums.StatisticEnum;
+import org.dbsyncer.biz.enums.ThreadPoolMetricEnum;
+import org.dbsyncer.biz.model.AppReportMetric;
+import org.dbsyncer.biz.model.MappingReportMetric;
+import org.dbsyncer.biz.model.MetricResponse;
+import org.dbsyncer.biz.model.MetricResponseInfo;
+import org.dbsyncer.biz.model.Sample;
+import org.dbsyncer.common.model.Paging;
+import org.dbsyncer.common.scheduled.ScheduledTaskJob;
+import org.dbsyncer.common.scheduled.ScheduledTaskService;
+import org.dbsyncer.common.util.CollectionUtils;
+import org.dbsyncer.common.util.StringUtil;
+import org.dbsyncer.connector.constant.ConnectorConstant;
+import org.dbsyncer.parser.ProfileComponent;
+import org.dbsyncer.parser.flush.BufferActuator;
+import org.dbsyncer.parser.flush.impl.BufferActuatorRouter;
+import org.dbsyncer.parser.flush.impl.TableGroupBufferActuator;
+import org.dbsyncer.parser.model.Mapping;
+import org.dbsyncer.parser.model.Meta;
+import org.dbsyncer.parser.model.TableGroup;
+import org.dbsyncer.storage.StorageService;
+import org.dbsyncer.storage.constant.ConfigConstant;
+import org.dbsyncer.storage.enums.StorageDataStatusEnum;
+import org.dbsyncer.storage.enums.StorageEnum;
+import org.dbsyncer.storage.query.Query;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.function.Consumer;
+import java.util.stream.Collectors;
+
+/**
+ * @author AE86
+ * @version 1.0.0
+ * @date 2020/04/23 11:30
+ */
+@Component
+public class MetricReporter implements ScheduledTaskJob {
+
+    private final Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Resource
+    private ProfileComponent profileComponent;
+
+    @Resource
+    private BufferActuator generalBufferActuator;
+
+    @Resource
+    private BufferActuator storageBufferActuator;
+
+    @Resource
+    private BufferActuatorRouter bufferActuatorRouter;
+
+    @Resource
+    private ScheduledTaskService scheduledTaskService;
+
+    @Resource
+    private StorageService storageService;
+
+    private volatile boolean running;
+
+    private LocalDateTime queryTime;
+
+    private final MappingReportMetric mappingReportMetric = new MappingReportMetric();
+
+    private final int SHOW_BUFFER_ACTUATOR_SIZE = 6;
+
+    @PostConstruct
+    private void init() {
+        scheduledTaskService.start(5000, this);
+    }
+
+    public List<MetricResponse> getMetricInfo() {
+        List<MetricResponseInfo> list = new ArrayList<>();
+        BufferActuatorMetricEnum general = BufferActuatorMetricEnum.GENERAL;
+        BufferActuatorMetricEnum storage = BufferActuatorMetricEnum.STORAGE;
+        list.add(collect(generalBufferActuator, general.getCode(), general.getGroup(), general.getMetricName()));
+        list.add(collect(storageBufferActuator, storage.getCode(), storage.getGroup(), storage.getMetricName()));
+        if (!CollectionUtils.isEmpty(bufferActuatorRouter.getRouter())) {
+            List<MetricResponseInfo> tableList = new ArrayList<>();
+            String tableGroupCode = BufferActuatorMetricEnum.TABLE_GROUP.getCode();
+            bufferActuatorRouter.getRouter().forEach((metaId, group) -> {
+                Meta meta = profileComponent.getMeta(metaId);
+                Mapping mapping = profileComponent.getMapping(meta.getMappingId());
+                group.forEach((k, bufferActuator) -> {
+                    if (bufferActuator instanceof TableGroupBufferActuator) {
+                        TableGroupBufferActuator actuator = bufferActuator;
+                        TableGroup tableGroup = profileComponent.getTableGroup(actuator.getTableGroupId());
+                        String metricName = new StringBuilder()
+                                .append(tableGroup.getSourceTable().getName())
+                                .append(" > ")
+                                .append(tableGroup.getTargetTable().getName()).toString();
+                        tableList.add(collect(bufferActuator, tableGroupCode, mapping.getName(), metricName));
+                    }
+                });
+            });
+            List<MetricResponseInfo> sortList = tableList.stream()
+                    .sorted(Comparator.comparing(MetricResponseInfo::getQueueUp).reversed())
+                    .collect(Collectors.toList());
+            list.addAll(sortList.size() <= SHOW_BUFFER_ACTUATOR_SIZE ? sortList : sortList.subList(0, SHOW_BUFFER_ACTUATOR_SIZE));
+        }
+        return list.stream().map(info -> info.getResponse()).collect(Collectors.toList());
+    }
+
+    public AppReportMetric getAppReportMetric() {
+        queryTime = LocalDateTime.now();
+        AppReportMetric report = new AppReportMetric();
+        report.setSuccess(mappingReportMetric.getSuccess());
+        report.setFail(mappingReportMetric.getFail());
+        report.setInsert(mappingReportMetric.getInsert());
+        report.setUpdate(mappingReportMetric.getUpdate());
+        report.setDelete(mappingReportMetric.getDelete());
+        // 堆积任务(通用执行器 + 表执行器)
+        report.setQueueUp(bufferActuatorRouter.getQueueSize().addAndGet(generalBufferActuator.getQueue().size()));
+        report.setQueueCapacity(bufferActuatorRouter.getQueueCapacity().addAndGet(generalBufferActuator.getQueueCapacity()));
+        // 持久化任务
+        report.setStorageQueueUp(storageBufferActuator.getQueue().size());
+        report.setStorageQueueCapacity(storageBufferActuator.getQueueCapacity());
+        return report;
+    }
+
+    @Override
+    public void run() {
+        if (running || null == queryTime) {
+            return;
+        }
+        // 非活动时间范围(30s内)
+        if (LocalDateTime.now().minusSeconds(30).isAfter(queryTime)) {
+            return;
+        }
+
+        // 刷新报表
+        try {
+            running = true;
+            final List<Meta> metaAll = profileComponent.getMetaAll();
+            mappingReportMetric.setSuccess(getMappingSuccess(metaAll));
+            mappingReportMetric.setFail(getMappingFail(metaAll));
+            mappingReportMetric.setInsert(getMappingInsert(metaAll));
+            mappingReportMetric.setUpdate(getMappingUpdate(metaAll));
+            mappingReportMetric.setDelete(getMappingDelete(metaAll));
+        } catch (Exception e) {
+            logger.error(e.getMessage());
+        } finally {
+            running = false;
+        }
+    }
+
+    /**
+     * 获取所有驱动成功数
+     *
+     * @param metaAll
+     * @return
+     */
+    private long getMappingSuccess(List<Meta> metaAll) {
+        return queryMappingMetricCount(metaAll, (query) -> query.addFilter(ConfigConstant.DATA_SUCCESS, StorageDataStatusEnum.SUCCESS.getValue()));
+    }
+
+    /**
+     * 获取所有驱动失败数
+     *
+     * @param metaAll
+     * @return
+     */
+    private long getMappingFail(List<Meta> metaAll) {
+        return queryMappingMetricCount(metaAll, (query) -> query.addFilter(ConfigConstant.DATA_SUCCESS, StorageDataStatusEnum.FAIL.getValue()));
+    }
+
+    /**
+     * 获取所有驱动事件插入数
+     *
+     * @param metaAll
+     * @return
+     */
+    private long getMappingInsert(List<Meta> metaAll) {
+        return queryMappingMetricCount(metaAll, (query) -> query.addFilter(ConfigConstant.DATA_EVENT, ConnectorConstant.OPERTION_INSERT));
+    }
+
+    /**
+     * 获取所有驱动事件更新数
+     *
+     * @param metaAll
+     * @return
+     */
+    private long getMappingUpdate(List<Meta> metaAll) {
+        return queryMappingMetricCount(metaAll, (query) -> query.addFilter(ConfigConstant.DATA_EVENT, ConnectorConstant.OPERTION_UPDATE));
+    }
+
+    /**
+     * 获取所有驱动事件删除数
+     *
+     * @param metaAll
+     * @return
+     */
+    private long getMappingDelete(List<Meta> metaAll) {
+        return queryMappingMetricCount(metaAll, (query) -> query.addFilter(ConfigConstant.DATA_EVENT, ConnectorConstant.OPERTION_DELETE));
+    }
+
+    private long queryMappingMetricCount(List<Meta> metaAll, Consumer<Query> operation) {
+        AtomicLong total = new AtomicLong(0);
+        if (!CollectionUtils.isEmpty(metaAll)) {
+            Query query = new Query(1, 1);
+            query.setQueryTotal(true);
+            query.setType(StorageEnum.DATA);
+            operation.accept(query);
+            metaAll.forEach(meta -> {
+                query.setMetaId(meta.getId());
+                Paging paging = storageService.query(query);
+                total.getAndAdd(paging.getTotal());
+            });
+        }
+        return total.get();
+    }
+
+    private MetricResponseInfo collect(BufferActuator bufferActuator, String code, String group, String metricName) {
+        MetricResponseInfo info = new MetricResponseInfo();
+        ThreadPoolTaskExecutor threadTask = (ThreadPoolTaskExecutor) bufferActuator.getExecutor();
+        ThreadPoolExecutor pool = threadTask.getThreadPoolExecutor();
+        info.setQueueUp(bufferActuator.getQueue().size());
+        StringBuilder msg = new StringBuilder();
+        msg.append("堆积").append(StringUtil.COLON).append(info.getQueueUp());
+        msg.append(StringUtil.FORWARD_SLASH).append(bufferActuator.getQueueCapacity()).append(StringUtil.SPACE);
+        msg.append(ThreadPoolMetricEnum.CORE_SIZE.getMetricName()).append(StringUtil.COLON).append(pool.getActiveCount());
+        msg.append(StringUtil.FORWARD_SLASH).append(pool.getCorePoolSize()).append(StringUtil.SPACE);
+        msg.append(ThreadPoolMetricEnum.COMPLETED.getMetricName()).append(StringUtil.COLON).append(pool.getCompletedTaskCount());
+        info.setResponse(new MetricResponse(code, group, metricName, Arrays.asList(new Sample(StatisticEnum.COUNT.getTagValueRepresentation(), msg.toString()))));
+        return info;
+    }
+
 }

+ 10 - 10
dbsyncer-biz/src/main/java/org/dbsyncer/biz/impl/MonitorServiceImpl.java

@@ -24,12 +24,11 @@ import org.dbsyncer.common.util.JsonUtil;
 import org.dbsyncer.common.util.NumberUtil;
 import org.dbsyncer.common.util.StringUtil;
 import org.dbsyncer.connector.enums.FilterEnum;
-import org.dbsyncer.monitor.Monitor;
-import org.dbsyncer.monitor.enums.BufferActuatorMetricEnum;
-import org.dbsyncer.monitor.enums.DiskMetricEnum;
-import org.dbsyncer.monitor.enums.MetricEnum;
-import org.dbsyncer.monitor.model.AppReportMetric;
-import org.dbsyncer.monitor.model.MetricResponse;
+import org.dbsyncer.biz.enums.BufferActuatorMetricEnum;
+import org.dbsyncer.biz.enums.DiskMetricEnum;
+import org.dbsyncer.biz.enums.MetricEnum;
+import org.dbsyncer.biz.model.AppReportMetric;
+import org.dbsyncer.biz.model.MetricResponse;
 import org.dbsyncer.parser.ProfileComponent;
 import org.dbsyncer.parser.enums.MetaEnum;
 import org.dbsyncer.parser.enums.ModelEnum;
@@ -57,6 +56,7 @@ import javax.annotation.Resource;
 import java.sql.Timestamp;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Comparator;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -74,7 +74,7 @@ public class MonitorServiceImpl extends BaseServiceImpl implements MonitorServic
     private final Logger logger = LoggerFactory.getLogger(getClass());
 
     @Resource
-    private Monitor monitor;
+    private MetricReporter metricReporter;
 
     @Resource
     private ProfileComponent profileComponent;
@@ -218,12 +218,12 @@ public class MonitorServiceImpl extends BaseServiceImpl implements MonitorServic
 
     @Override
     public List<MetricEnum> getMetricEnumAll() {
-        return monitor.getMetricEnumAll();
+        return Arrays.asList(MetricEnum.values());
     }
 
     @Override
     public AppReportMetricVo queryAppReportMetric(List<MetricResponse> metrics) {
-        AppReportMetric appReportMetric = monitor.getAppReportMetric();
+        AppReportMetric appReportMetric = metricReporter.getAppReportMetric();
         AppReportMetricVo vo = new AppReportMetricVo();
         BeanUtils.copyProperties(appReportMetric, vo);
         vo.setMetrics(getMetrics(metrics));
@@ -334,7 +334,7 @@ public class MonitorServiceImpl extends BaseServiceImpl implements MonitorServic
 
     private List<MetricResponseVo> getMetrics(List<MetricResponse> metrics) {
         // 系统指标
-        List<MetricResponse> metricList = monitor.getMetricInfo();
+        List<MetricResponse> metricList = metricReporter.getMetricInfo();
         // 线程池状态
         metrics.addAll(metricList);
 

+ 1 - 1
dbsyncer-biz/src/main/java/org/dbsyncer/biz/metric/impl/CpuMetricDetailFormatter.java

@@ -2,7 +2,7 @@ package org.dbsyncer.biz.metric.impl;
 
 import org.dbsyncer.biz.metric.AbstractMetricDetailFormatter;
 import org.dbsyncer.biz.vo.MetricResponseVo;
-import org.dbsyncer.monitor.model.Sample;
+import org.dbsyncer.biz.model.Sample;
 
 public final class CpuMetricDetailFormatter extends AbstractMetricDetailFormatter {
 

+ 1 - 1
dbsyncer-biz/src/main/java/org/dbsyncer/biz/metric/impl/DiskMetricDetailFormatter.java

@@ -2,7 +2,7 @@ package org.dbsyncer.biz.metric.impl;
 
 import org.dbsyncer.biz.metric.AbstractMetricDetailFormatter;
 import org.dbsyncer.biz.vo.MetricResponseVo;
-import org.dbsyncer.monitor.model.Sample;
+import org.dbsyncer.biz.model.Sample;
 
 import java.math.BigDecimal;
 

+ 1 - 1
dbsyncer-biz/src/main/java/org/dbsyncer/biz/metric/impl/DoubleRoundMetricDetailFormatter.java

@@ -2,7 +2,7 @@ package org.dbsyncer.biz.metric.impl;
 
 import org.dbsyncer.biz.metric.AbstractMetricDetailFormatter;
 import org.dbsyncer.biz.vo.MetricResponseVo;
-import org.dbsyncer.monitor.model.Sample;
+import org.dbsyncer.biz.model.Sample;
 
 public final class DoubleRoundMetricDetailFormatter extends AbstractMetricDetailFormatter {
 

+ 1 - 1
dbsyncer-biz/src/main/java/org/dbsyncer/biz/metric/impl/GCMetricDetailFormatter.java

@@ -2,7 +2,7 @@ package org.dbsyncer.biz.metric.impl;
 
 import org.dbsyncer.biz.metric.AbstractMetricDetailFormatter;
 import org.dbsyncer.biz.vo.MetricResponseVo;
-import org.dbsyncer.monitor.model.Sample;
+import org.dbsyncer.biz.model.Sample;
 
 import java.util.List;
 

+ 1 - 1
dbsyncer-biz/src/main/java/org/dbsyncer/biz/metric/impl/MemoryMetricDetailFormatter.java

@@ -2,7 +2,7 @@ package org.dbsyncer.biz.metric.impl;
 
 import org.dbsyncer.biz.metric.AbstractMetricDetailFormatter;
 import org.dbsyncer.biz.vo.MetricResponseVo;
-import org.dbsyncer.monitor.model.Sample;
+import org.dbsyncer.biz.model.Sample;
 
 public final class MemoryMetricDetailFormatter extends AbstractMetricDetailFormatter {
 

+ 1 - 1
dbsyncer-biz/src/main/java/org/dbsyncer/biz/metric/impl/ValueMetricDetailFormatter.java

@@ -2,7 +2,7 @@ package org.dbsyncer.biz.metric.impl;
 
 import org.dbsyncer.biz.metric.AbstractMetricDetailFormatter;
 import org.dbsyncer.biz.vo.MetricResponseVo;
-import org.dbsyncer.monitor.model.Sample;
+import org.dbsyncer.biz.model.Sample;
 
 public final class ValueMetricDetailFormatter extends AbstractMetricDetailFormatter {
 

+ 1 - 1
dbsyncer-monitor/src/main/java/org/dbsyncer/monitor/model/AppReportMetric.java → dbsyncer-biz/src/main/java/org/dbsyncer/biz/model/AppReportMetric.java

@@ -1,4 +1,4 @@
-package org.dbsyncer.monitor.model;
+package org.dbsyncer.biz.model;
 
 public class AppReportMetric extends MappingReportMetric{
 

+ 69 - 69
dbsyncer-monitor/src/main/java/org/dbsyncer/monitor/model/MappingReportMetric.java → dbsyncer-biz/src/main/java/org/dbsyncer/biz/model/MappingReportMetric.java

@@ -1,70 +1,70 @@
-package org.dbsyncer.monitor.model;
-
-public class MappingReportMetric {
-
-    /**
-     * 已处理成功数
-     */
-    private long success;
-
-    /**
-     * 已处理失败数
-     */
-    private long fail;
-
-    /**
-     * 插入事件
-     */
-    private long insert;
-
-    /**
-     * 更新事件
-     */
-    private long update;
-
-    /**
-     * 删除事件
-     */
-    private long delete;
-
-    public long getSuccess() {
-        return success;
-    }
-
-    public void setSuccess(long success) {
-        this.success = success;
-    }
-
-    public long getFail() {
-        return fail;
-    }
-
-    public void setFail(long fail) {
-        this.fail = fail;
-    }
-
-    public long getInsert() {
-        return insert;
-    }
-
-    public void setInsert(long insert) {
-        this.insert = insert;
-    }
-
-    public long getUpdate() {
-        return update;
-    }
-
-    public void setUpdate(long update) {
-        this.update = update;
-    }
-
-    public long getDelete() {
-        return delete;
-    }
-
-    public void setDelete(long delete) {
-        this.delete = delete;
-    }
-
+package org.dbsyncer.biz.model;
+
+public class MappingReportMetric {
+
+    /**
+     * 已处理成功数
+     */
+    private long success;
+
+    /**
+     * 已处理失败数
+     */
+    private long fail;
+
+    /**
+     * 插入事件
+     */
+    private long insert;
+
+    /**
+     * 更新事件
+     */
+    private long update;
+
+    /**
+     * 删除事件
+     */
+    private long delete;
+
+    public long getSuccess() {
+        return success;
+    }
+
+    public void setSuccess(long success) {
+        this.success = success;
+    }
+
+    public long getFail() {
+        return fail;
+    }
+
+    public void setFail(long fail) {
+        this.fail = fail;
+    }
+
+    public long getInsert() {
+        return insert;
+    }
+
+    public void setInsert(long insert) {
+        this.insert = insert;
+    }
+
+    public long getUpdate() {
+        return update;
+    }
+
+    public void setUpdate(long update) {
+        this.update = update;
+    }
+
+    public long getDelete() {
+        return delete;
+    }
+
+    public void setDelete(long delete) {
+        this.delete = delete;
+    }
+
 }

+ 55 - 55
dbsyncer-monitor/src/main/java/org/dbsyncer/monitor/model/MetricResponse.java → dbsyncer-biz/src/main/java/org/dbsyncer/biz/model/MetricResponse.java

@@ -1,56 +1,56 @@
-package org.dbsyncer.monitor.model;
-
-import java.util.List;
-
-public class MetricResponse {
-
-    private String code;
-
-    private String group;
-
-    private String metricName;
-
-    private List<Sample> measurements;
-
-    public MetricResponse() {
-    }
-
-    public MetricResponse(String code, String group, String metricName, List<Sample> measurements) {
-        this.code = code;
-        this.group = group;
-        this.metricName = metricName;
-        this.measurements = measurements;
-    }
-
-    public String getCode() {
-        return code;
-    }
-
-    public void setCode(String code) {
-        this.code = code;
-    }
-
-    public String getGroup() {
-        return group;
-    }
-
-    public void setGroup(String group) {
-        this.group = group;
-    }
-
-    public String getMetricName() {
-        return metricName;
-    }
-
-    public void setMetricName(String metricName) {
-        this.metricName = metricName;
-    }
-
-    public List<Sample> getMeasurements() {
-        return measurements;
-    }
-
-    public void setMeasurements(List<Sample> measurements) {
-        this.measurements = measurements;
-    }
+package org.dbsyncer.biz.model;
+
+import java.util.List;
+
+public class MetricResponse {
+
+    private String code;
+
+    private String group;
+
+    private String metricName;
+
+    private List<Sample> measurements;
+
+    public MetricResponse() {
+    }
+
+    public MetricResponse(String code, String group, String metricName, List<Sample> measurements) {
+        this.code = code;
+        this.group = group;
+        this.metricName = metricName;
+        this.measurements = measurements;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getGroup() {
+        return group;
+    }
+
+    public void setGroup(String group) {
+        this.group = group;
+    }
+
+    public String getMetricName() {
+        return metricName;
+    }
+
+    public void setMetricName(String metricName) {
+        this.metricName = metricName;
+    }
+
+    public List<Sample> getMeasurements() {
+        return measurements;
+    }
+
+    public void setMeasurements(List<Sample> measurements) {
+        this.measurements = measurements;
+    }
 }

+ 23 - 23
dbsyncer-monitor/src/main/java/org/dbsyncer/monitor/model/MetricResponseInfo.java → dbsyncer-biz/src/main/java/org/dbsyncer/biz/model/MetricResponseInfo.java

@@ -1,24 +1,24 @@
-package org.dbsyncer.monitor.model;
-
-public class MetricResponseInfo {
-
-    private MetricResponse response;
-
-    private long queueUp;
-
-    public MetricResponse getResponse() {
-        return response;
-    }
-
-    public void setResponse(MetricResponse response) {
-        this.response = response;
-    }
-
-    public long getQueueUp() {
-        return queueUp;
-    }
-
-    public void setQueueUp(long queueUp) {
-        this.queueUp = queueUp;
-    }
+package org.dbsyncer.biz.model;
+
+public class MetricResponseInfo {
+
+    private MetricResponse response;
+
+    private long queueUp;
+
+    public MetricResponse getResponse() {
+        return response;
+    }
+
+    public void setResponse(MetricResponse response) {
+        this.response = response;
+    }
+
+    public long getQueueUp() {
+        return queueUp;
+    }
+
+    public void setQueueUp(long queueUp) {
+        this.queueUp = queueUp;
+    }
 }

+ 28 - 28
dbsyncer-monitor/src/main/java/org/dbsyncer/monitor/model/Sample.java → dbsyncer-biz/src/main/java/org/dbsyncer/biz/model/Sample.java

@@ -1,29 +1,29 @@
-package org.dbsyncer.monitor.model;
-
-public final class Sample {
-
-    private String statistic;
-
-    private Object value;
-
-    public Sample(String statistic, Object value) {
-        this.statistic = statistic;
-        this.value = value;
-    }
-
-    public String getStatistic() {
-        return statistic;
-    }
-
-    public void setStatistic(String statistic) {
-        this.statistic = statistic;
-    }
-
-    public Object getValue() {
-        return value;
-    }
-
-    public void setValue(Object value) {
-        this.value = value;
-    }
+package org.dbsyncer.biz.model;
+
+public final class Sample {
+
+    private String statistic;
+
+    private Object value;
+
+    public Sample(String statistic, Object value) {
+        this.statistic = statistic;
+        this.value = value;
+    }
+
+    public String getStatistic() {
+        return statistic;
+    }
+
+    public void setStatistic(String statistic) {
+        this.statistic = statistic;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+
+    public void setValue(Object value) {
+        this.value = value;
+    }
 }

+ 1 - 1
dbsyncer-biz/src/main/java/org/dbsyncer/biz/vo/AppReportMetricVo.java

@@ -1,6 +1,6 @@
 package org.dbsyncer.biz.vo;
 
-import org.dbsyncer.monitor.model.AppReportMetric;
+import org.dbsyncer.biz.model.AppReportMetric;
 
 import java.util.List;
 

+ 1 - 1
dbsyncer-biz/src/main/java/org/dbsyncer/biz/vo/MetricResponseVo.java

@@ -1,6 +1,6 @@
 package org.dbsyncer.biz.vo;
 
-import org.dbsyncer.monitor.model.MetricResponse;
+import org.dbsyncer.biz.model.MetricResponse;
 
 public class MetricResponseVo extends MetricResponse {
 

+ 0 - 22
dbsyncer-monitor/pom.xml

@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <artifactId>dbsyncer</artifactId>
-        <groupId>org.ghi</groupId>
-        <version>1.2.7_1103</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>dbsyncer-monitor</artifactId>
-
-    <dependencies>
-        <!-- Manager 控制器 -->
-        <dependency>
-            <groupId>org.ghi</groupId>
-            <artifactId>dbsyncer-manager</artifactId>
-            <version>${project.parent.version}</version>
-        </dependency>
-
-    </dependencies>
-</project>

+ 0 - 22
dbsyncer-monitor/src/main/java/org/dbsyncer/monitor/Monitor.java

@@ -1,22 +0,0 @@
-package org.dbsyncer.monitor;
-
-import org.dbsyncer.monitor.enums.MetricEnum;
-import org.dbsyncer.monitor.model.AppReportMetric;
-import org.dbsyncer.monitor.model.MetricResponse;
-
-import java.util.List;
-
-/**
- * @author AE86
- * @version 1.0.0
- * @date 2020/04/23 11:30
- */
-public interface Monitor {
-
-    List<MetricEnum> getMetricEnumAll();
-
-    List<MetricResponse> getMetricInfo();
-
-    AppReportMetric getAppReportMetric();
-
-}

+ 0 - 27
dbsyncer-monitor/src/main/java/org/dbsyncer/monitor/MonitorException.java

@@ -1,27 +0,0 @@
-package org.dbsyncer.monitor;
-
-/**
- * @author AE86
- * @version 1.0.0
- * @date 2021/7/23 22:39
- */
-public class MonitorException extends RuntimeException {
-
-	private static final long serialVersionUID = 1L;
-
-	public MonitorException(String message) {
-        super(message);
-    }
-
-    public MonitorException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    public MonitorException(Throwable cause) {
-        super(cause);
-    }
-
-    protected MonitorException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-}

+ 5 - 5
dbsyncer-web/src/main/java/org/dbsyncer/web/controller/monitor/MonitorController.java

@@ -10,11 +10,11 @@ import org.dbsyncer.biz.vo.RestResult;
 import org.dbsyncer.biz.vo.SystemConfigVo;
 import org.dbsyncer.common.util.CollectionUtils;
 import org.dbsyncer.common.util.DateFormatUtil;
-import org.dbsyncer.monitor.enums.DiskMetricEnum;
-import org.dbsyncer.monitor.enums.MetricEnum;
-import org.dbsyncer.monitor.enums.StatisticEnum;
-import org.dbsyncer.monitor.model.MetricResponse;
-import org.dbsyncer.monitor.model.Sample;
+import org.dbsyncer.biz.enums.DiskMetricEnum;
+import org.dbsyncer.biz.enums.MetricEnum;
+import org.dbsyncer.biz.enums.StatisticEnum;
+import org.dbsyncer.biz.model.MetricResponse;
+import org.dbsyncer.biz.model.Sample;
 import org.dbsyncer.web.controller.BaseController;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

+ 1 - 2
pom.xml

@@ -11,7 +11,7 @@
     <name>dbsyncer</name>
     <url>https://gitee.com/ghi/dbsyncer</url>
 
-    <!-- 管理的子模块(12个) -->
+    <!-- 管理的子模块(10个) -->
     <modules>
         <module>dbsyncer-biz</module>
         <module>dbsyncer-cluster</module>
@@ -19,7 +19,6 @@
         <module>dbsyncer-connector</module>
         <module>dbsyncer-listener</module>
         <module>dbsyncer-manager</module>
-        <module>dbsyncer-monitor</module>
         <module>dbsyncer-parser</module>
         <module>dbsyncer-plugin</module>
         <module>dbsyncer-storage</module>