From 1111242c2c418ad15d8521b550f7abd0a4df83a4 Mon Sep 17 00:00:00 2001 From: "chen.ma" Date: Mon, 5 Sep 2022 08:16:44 +0800 Subject: [PATCH] Monitor code changes --- .../getting_started/config/hippo4j-config-monitor.md | 3 +-- .../hippo4j/monitor/prometheus/PrometheusMonitorHandler.java | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/docs/docs/user_docs/getting_started/config/hippo4j-config-monitor.md b/docs/docs/user_docs/getting_started/config/hippo4j-config-monitor.md index a018ade8..81adfc26 100644 --- a/docs/docs/user_docs/getting_started/config/hippo4j-config-monitor.md +++ b/docs/docs/user_docs/getting_started/config/hippo4j-config-monitor.md @@ -51,7 +51,7 @@ management: spring: dynamic: thread-pool: - collect-type: metric + collect-type: prometheus ``` Prometheus 配置任务,配置成功后需重启。 @@ -76,7 +76,6 @@ Grafana DashBoard 配置。 ![](https://images-machen.oss-cn-beijing.aliyuncs.com/43_65f6020ed111b6bb3808ec338576bd6b.png) - ![](https://images-machen.oss-cn-beijing.aliyuncs.com/image-20220327171957444.png) 获取到 JSON 文件后,导入至 Grafana。 diff --git a/hippo4j-monitor/hippo4j-monitor-prometheus/src/main/java/cn/hippo4j/monitor/prometheus/PrometheusMonitorHandler.java b/hippo4j-monitor/hippo4j-monitor-prometheus/src/main/java/cn/hippo4j/monitor/prometheus/PrometheusMonitorHandler.java index c5dc22c3..7d8e283e 100644 --- a/hippo4j-monitor/hippo4j-monitor-prometheus/src/main/java/cn/hippo4j/monitor/prometheus/PrometheusMonitorHandler.java +++ b/hippo4j-monitor/hippo4j-monitor-prometheus/src/main/java/cn/hippo4j/monitor/prometheus/PrometheusMonitorHandler.java @@ -61,20 +61,16 @@ public class PrometheusMonitorHandler extends AbstractDynamicThreadPoolMonitor { Iterable tags = Lists.newArrayList( Tag.of(DYNAMIC_THREAD_POOL_ID_TAG, poolRunStateInfo.getTpId()), Tag.of(APPLICATION_NAME_TAG, applicationName)); - // load Metrics.gauge(metricName("current.load"), tags, poolRunStateInfo, ThreadPoolRunStateInfo::getSimpleCurrentLoad); Metrics.gauge(metricName("peak.load"), tags, poolRunStateInfo, ThreadPoolRunStateInfo::getSimplePeakLoad); - // thread pool Metrics.gauge(metricName("core.size"), tags, poolRunStateInfo, ThreadPoolRunStateInfo::getCoreSize); Metrics.gauge(metricName("maximum.size"), tags, poolRunStateInfo, ThreadPoolRunStateInfo::getMaximumSize); Metrics.gauge(metricName("current.size"), tags, poolRunStateInfo, ThreadPoolRunStateInfo::getPoolSize); Metrics.gauge(metricName("largest.size"), tags, poolRunStateInfo, ThreadPoolRunStateInfo::getLargestPoolSize); Metrics.gauge(metricName("active.size"), tags, poolRunStateInfo, ThreadPoolRunStateInfo::getActiveSize); - // queue Metrics.gauge(metricName("queue.size"), tags, poolRunStateInfo, ThreadPoolRunStateInfo::getQueueSize); Metrics.gauge(metricName("queue.capacity"), tags, poolRunStateInfo, ThreadPoolRunStateInfo::getQueueCapacity); Metrics.gauge(metricName("queue.remaining.capacity"), tags, poolRunStateInfo, ThreadPoolRunStateInfo::getQueueRemainingCapacity); - // other Metrics.gauge(metricName("completed.task.count"), tags, poolRunStateInfo, ThreadPoolRunStateInfo::getCompletedTaskCount); Metrics.gauge(metricName("reject.count"), tags, poolRunStateInfo, ThreadPoolRunStateInfo::getRejectCount); }