You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2022/03/07 15:58:22 UTC
[iotdb] branch master updated: [IOTDB-2691][Metric] update metric doc (#5172)
This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new c788726 [IOTDB-2691][Metric] update metric doc (#5172)
c788726 is described below
commit c7887266826d8b2b20dae10b3e3cdf2d2e37a5f8
Author: ZhangHongYin <46...@users.noreply.github.com>
AuthorDate: Mon Mar 7 23:57:35 2022 +0800
[IOTDB-2691][Metric] update metric doc (#5172)
* [Metric] fix doc in iotdb-metric.yml
* [Metric] update doc and level
---
.../log/manage/PartitionedSnapshotLogManager.java | 2 +-
.../server/handlers/caller/ElectionHandler.java | 2 +-
.../cluster/utils/nodetool/ClusterMonitor.java | 4 +-
docs/UserGuide/Maintenance-Tools/Metric-Tool.md | 61 ++++++-----
docs/zh/UserGuide/Maintenance-Tools/Metric-Tool.md | 72 +++++++------
metrics/ReadMe.md | 4 +-
.../dropwizard/DropwizardMetricManagerTest.java | 117 +++++++++++----------
.../main/assembly/resources/conf/iotdb-metric.yml | 4 +-
.../apache/iotdb/metrics/config/MetricConfig.java | 2 +-
.../iotdb/metrics/config/MetricConfigTest.java | 2 +-
.../interface/src/test/resources/iotdb-metric.yml | 4 +-
.../micrometer/MicrometerMetricManagerTest.java | 6 +-
.../apache/iotdb/db/engine/cache/ChunkCache.java | 2 +-
.../db/engine/cache/TimeSeriesMetadataCache.java | 4 +-
.../engine/compaction/CompactionTaskManager.java | 2 +-
.../compaction/task/AbstractCompactionTask.java | 2 +-
.../apache/iotdb/db/engine/flush/FlushManager.java | 4 +-
.../iotdb/db/engine/flush/MemTableFlushTask.java | 2 +-
.../iotdb/db/engine/memtable/AbstractMemTable.java | 8 +-
.../engine/storagegroup/TsFileProcessorInfo.java | 6 +-
.../storagegroup/VirtualStorageGroupProcessor.java | 2 +-
.../org/apache/iotdb/db/metadata/MManager.java | 8 +-
.../db/query/pool/RawQueryReadTaskPoolManager.java | 4 +-
.../iotdb/db/service/metrics/MetricsService.java | 12 +--
.../db/service/thrift/ProcessorWithMetrics.java | 2 +-
.../db/service/thrift/impl/TSServiceImpl.java | 4 +-
26 files changed, 186 insertions(+), 156 deletions(-)
diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/log/manage/PartitionedSnapshotLogManager.java b/cluster/src/main/java/org/apache/iotdb/cluster/log/manage/PartitionedSnapshotLogManager.java
index c6bbdfa..bc16376 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/log/manage/PartitionedSnapshotLogManager.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/log/manage/PartitionedSnapshotLogManager.java
@@ -88,7 +88,7 @@ public abstract class PartitionedSnapshotLogManager<T extends Snapshot> extends
.getMetricManager()
.getOrCreateAutoGauge(
Metric.CLUSTER_UNCOMMITTED_LOG.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
getUnCommittedEntryManager().getAllEntries(),
List::size,
Tag.NAME.toString(),
diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/server/handlers/caller/ElectionHandler.java b/cluster/src/main/java/org/apache/iotdb/cluster/server/handlers/caller/ElectionHandler.java
index 22f0e83..9f16f3f 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/server/handlers/caller/ElectionHandler.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/server/handlers/caller/ElectionHandler.java
@@ -137,7 +137,7 @@ public class ElectionHandler implements AsyncMethodCallback<Long> {
.count(
1,
Metric.CLUSTER_ELECT.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
Tag.NAME.toString(),
raftMember.getThisNode().internalIp,
Tag.STATUS.toString(),
diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/utils/nodetool/ClusterMonitor.java b/cluster/src/main/java/org/apache/iotdb/cluster/utils/nodetool/ClusterMonitor.java
index 2e8dd50..18993df 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/utils/nodetool/ClusterMonitor.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/utils/nodetool/ClusterMonitor.java
@@ -127,7 +127,7 @@ public class ClusterMonitor implements ClusterMonitorMBean, IService {
.gauge(
count,
Metric.CLUSTER_NODE_LEADER_COUNT.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
Tag.NAME.toString(),
node.internalIp);
}
@@ -156,7 +156,7 @@ public class ClusterMonitor implements ClusterMonitorMBean, IService {
.gauge(
isAlive ? 1 : 0,
Metric.CLUSTER_NODE_STATUS.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
Tag.NAME.toString(),
node.internalIp);
}
diff --git a/docs/UserGuide/Maintenance-Tools/Metric-Tool.md b/docs/UserGuide/Maintenance-Tools/Metric-Tool.md
index 9cfb1bb..1758c1f 100644
--- a/docs/UserGuide/Maintenance-Tools/Metric-Tool.md
+++ b/docs/UserGuide/Maintenance-Tools/Metric-Tool.md
@@ -80,62 +80,62 @@ Next, we will choose Prometheus format data as samples to describe each kind of
| Metric | Tag | level | Description | Sample |
| ------------------- | --------------------- | ------ | ---------------------------------------- | -------------------------------------------- |
-| entry_seconds_count | name="interface name" | normal | The total request count of the interface | entry_seconds_count{name="openSession",} 1.0 |
-| entry_seconds_sum | name="interface name" | normal | The total cost seconds of the interface | entry_seconds_sum{name="openSession",} 0.024 |
-| entry_seconds_max | name="interface name" | normal | The max latency of the interface | entry_seconds_max{name="openSession",} 0.024 |
-| quantity_total | name="pointsIn" | normal | The total points inserted into IoTDB | quantity_total{name="pointsIn",} 1.0 |
+| entry_seconds_count | name="interface name" | important | The total request count of the interface | entry_seconds_count{name="openSession",} 1.0 |
+| entry_seconds_sum | name="interface name" | important | The total cost seconds of the interface | entry_seconds_sum{name="openSession",} 0.024 |
+| entry_seconds_max | name="interface name" | important | The max latency of the interface | entry_seconds_max{name="openSession",} 0.024 |
+| quantity_total | name="pointsIn" | important | The total points inserted into IoTDB | quantity_total{name="pointsIn",} 1.0 |
#### 4.3.2. File
| Metric | Tag | level | Description | Sample |
| ---------- | -------------------- | ------ | ----------------------------------------------- | --------------------------- |
-| file_size | name="wal/seq/unseq" | normal | The current file size of wal/seq/unseq in bytes | file_size{name="wal",} 67.0 |
-| file_count | name="wal/seq/unseq" | normal | The current count of wal/seq/unseq files | file_count{name="seq",} 1.0 |
+| file_size | name="wal/seq/unseq" | important | The current file size of wal/seq/unseq in bytes | file_size{name="wal",} 67.0 |
+| file_count | name="wal/seq/unseq" | important | The current count of wal/seq/unseq files | file_count{name="seq",} 1.0 |
#### 4.3.3. Flush
| Metric | Tag | level | Description | Sample |
| ----------------------- | ------------------------------------------- | ------ | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
-| queue | name="flush",<br />status="running/waiting" | normal | The count of current flushing tasks in running and waiting status | queue{name="flush",status="waiting",} 0.0<br/>queue{name="flush",status="running",} 0.0 |
-| cost_task_seconds_count | name="flush" | normal | The total count of flushing occurs till now | cost_task_seconds_count{name="flush",} 1.0 |
-| cost_task_seconds_max | name="flush" | normal | The seconds of the longest flushing task takes till now | cost_task_seconds_max{name="flush",} 0.363 |
-| cost_task_seconds_sum | name="flush" | normal | The total cost seconds of all flushing tasks till now | cost_task_seconds_sum{name="flush",} 0.363 |
+| queue | name="flush",<br />status="running/waiting" | important | The count of current flushing tasks in running and waiting status | queue{name="flush",status="waiting",} 0.0<br/>queue{name="flush",status="running",} 0.0 |
+| cost_task_seconds_count | name="flush" | important | The total count of flushing occurs till now | cost_task_seconds_count{name="flush",} 1.0 |
+| cost_task_seconds_max | name="flush" | important | The seconds of the longest flushing task takes till now | cost_task_seconds_max{name="flush",} 0.363 |
+| cost_task_seconds_sum | name="flush" | important | The total cost seconds of all flushing tasks till now | cost_task_seconds_sum{name="flush",} 0.363 |
#### 4.3.4. Compaction
| Metric | Tag | level | Description | Sample |
| ----------------------- | ----------------------------------------------------------------------- | ------ | ------------------------------------------------------------------- | ---------------------------------------------------- |
-| queue | name="compaction_inner/compaction_cross",<br />status="running/waiting" | normal | The count of current compaction tasks in running and waiting status | queue{name="compaction_inner",status="waiting",} 0.0 |
-| cost_task_seconds_count | name="compaction" | normal | The total count of compaction occurs till now | cost_task_seconds_count{name="compaction",} 1.0 |
-| cost_task_seconds_max | name="compaction" | normal | The seconds of the longest compaction task takes till now | cost_task_seconds_max{name="compaction",} 0.363 |
-| cost_task_seconds_sum | name="compaction" | normal | The total cost seconds of all compaction tasks till now | cost_task_seconds_sum{name="compaction",} 0.363 |
+| queue | name="compaction_inner/compaction_cross",<br />status="running/waiting" | important | The count of current compaction tasks in running and waiting status | queue{name="compaction_inner",status="waiting",} 0.0 |
+| cost_task_seconds_count | name="compaction" | important | The total count of compaction occurs till now | cost_task_seconds_count{name="compaction",} 1.0 |
+| cost_task_seconds_max | name="compaction" | important | The seconds of the longest compaction task takes till now | cost_task_seconds_max{name="compaction",} 0.363 |
+| cost_task_seconds_sum | name="compaction" | important | The total cost seconds of all compaction tasks till now | cost_task_seconds_sum{name="compaction",} 0.363 |
#### 4.3.5. Memory Usage
| Metric | Tag | level | Description | Sample |
| ------ | --------------------------------------- | ------ | --------------------------------------------------------------------- | --------------------------------- |
-| mem | name="chunkMetaData/storageGroup/mtree" | normal | Current memory size of chunkMetaData/storageGroup/mtree data in bytes | mem{name="chunkMetaData",} 2050.0 |
+| mem | name="chunkMetaData/storageGroup/mtree" | important | Current memory size of chunkMetaData/storageGroup/mtree data in bytes | mem{name="chunkMetaData",} 2050.0 |
#### 4.3.6. Cache Hit Ratio
| Metric | Tag | level | Description | Sample |
| --------- | --------------------------------------- | ------ | ----------------------------------------------------------------------------- | --------------------------- |
-| cache_hit | name="chunk/timeSeriesMeta/bloomFilter" | normal | Cache hit ratio of chunk/timeSeriesMeta and prevention ratio of bloom filter | cache_hit{name="chunk",} 80 |
+| cache_hit | name="chunk/timeSeriesMeta/bloomFilter" | important | Cache hit ratio of chunk/timeSeriesMeta and prevention ratio of bloom filter | cache_hit{name="chunk",} 80 |
#### 4.3.7. Business Data
| Metric | Tag | level | Description | Sample |
| -------- | ------------------------------------- | ------ | ------------------------------------------------------------- | -------------------------------- |
-| quantity | name="timeSeries/storageGroup/device" | normal | The current count of timeSeries/storageGroup/devices in IoTDB | quantity{name="timeSeries",} 1.0 |
+| quantity | name="timeSeries/storageGroup/device" | important | The current count of timeSeries/storageGroup/devices in IoTDB | quantity{name="timeSeries",} 1.0 |
#### 4.3.8. Cluster
| Metric | Tag | level | Description | Sample |
| ------------------------- | ------------------------------- | ------ | -------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
-| cluster_node_leader_count | name="{{ip}}" | normal | The count of ```dataGroupLeader``` on each node, which reflects the distribution of leaders | cluster_node_leader_count{name="127.0.0.1",} 2.0 |
-| cluster_uncommitted_log | name="{{ip_datagroupHeader}}" | normal | The count of ```uncommitted_log``` on each node in data groups it belongs to | cluster_uncommitted_log{name="127.0.0.1_Data-127.0.0.1-40010-raftId-0",} 0.0 |
-| cluster_node_status | name="{{ip}}" | normal | The current node status, 1=online 2=offline | cluster_node_status{name="127.0.0.1",} 1.0 |
-| cluster_elect_total | name="{{ip}}",status="fail/win" | normal | The count and result (won or failed) of elections the node participated in. | cluster_elect_total{name="127.0.0.1",status="win",} 1.0 |
+| cluster_node_leader_count | name="{{ip}}" | important | The count of ```dataGroupLeader``` on each node, which reflects the distribution of leaders | cluster_node_leader_count{name="127.0.0.1",} 2.0 |
+| cluster_uncommitted_log | name="{{ip_datagroupHeader}}" | important | The count of ```uncommitted_log``` on each node in data groups it belongs to | cluster_uncommitted_log{name="127.0.0.1_Data-127.0.0.1-40010-raftId-0",} 0.0 |
+| cluster_node_status | name="{{ip}}" | important | The current node status, 1=online 2=offline | cluster_node_status{name="127.0.0.1",} 1.0 |
+| cluster_elect_total | name="{{ip}}",status="fail/win" | important | The count and result (won or failed) of elections the node participated in. | cluster_elect_total{name="127.0.0.1",status="win",} 1.0 |
### 4.4. IoTDB PreDefined Metrics Set
Users can modify the value of `predefinedMetrics` in the `iotdb-metric.yml` file to enable the predefined set of metrics, which `LOGBACK` does not support in `dropwizard`.
@@ -190,7 +190,20 @@ Users can modify the value of `predefinedMetrics` in the `iotdb-metric.yml` file
| logback_events_total | {level="trace/debug/info/warn/error",} | The count of trace/debug/info/warn/error log events till now | logback_events_total{level="warn",} 0.0 |
### 4.5. Add custom metrics
-If you want to add your own metrics data in IoTDB, please see the [IoTDB Metric Framework] (https://github.com/apache/iotdb/tree/master/metrics) document.
+- If you want to add your own metrics data in IoTDB, please see the [IoTDB Metric Framework] (https://github.com/apache/iotdb/tree/master/metrics) document.
+- Metric embedded point definition rules
+ - `Metric`: The name of the monitoring item. For example, `entry_seconds_count` is the cumulative number of accesses to the interface, and `file_size` is the total number of files.
+ - `Tags`: Key-Value pair, used to identify monitored items, optional
+ - `name = xxx`: The name of the monitored item. For example, for the monitoring item`entry_seconds_count`, the meaning of name is the name of the monitored interface.
+ - `status = xxx`: The status of the monitored item is subdivided. For example, the monitoring item of the monitoring task can use this parameter to separate the running task and the stopped task.
+ - `user = xxx`: The monitored item is related to a specific user, such as the total number of writes by the root user.
+ - Customize for the situation...
+- Monitoring indicator level meaning:
+ - The default startup level for online operation is `Important` level, the default startup level for offline debugging is `Normal` level, and the audit strictness is `Core > Important > Normal > All`
+ - `Core`: The core indicator of the system, used by the **operation and maintenance personnel**, which is related to the performance, stability, and security** of the system, such as the status of the instance, the load of the system, etc.
+ - `Important`: An important indicator of the module, which is used by **operation and maintenance and testers**, and is directly related to **the running status of each module**, such as the number of merged files, execution status, etc.
+ - `Normal`: General indicators of the module, used by **developers** to facilitate **locating the module** when problems occur, such as specific key operation situations in the merger.
+ - `All`: All indicators of the module, used by **module developers**, often used when the problem is reproduced, so as to solve the problem quickly.
## 5. How to get these metrics?
@@ -211,13 +224,13 @@ metricReporterList:
monitorType: MICROMETER
# Level of metric level, options: [CORE, IMPORTANT, NORMAL, ALL]
-metricLevel: NORMAL
+metricLevel: IMPORTANT
# Predefined metric, options: [JVM, LOGBACK], LOGBACK are not supported in dropwizard
predefinedMetrics:
- JVM
-# Period time of push, only valid for dropwizard
+# Period time of push, only used by IoTDB Reporter
pushPeriodInSecond: 5
# The http server's port for prometheus exporter to get metric data.
diff --git a/docs/zh/UserGuide/Maintenance-Tools/Metric-Tool.md b/docs/zh/UserGuide/Maintenance-Tools/Metric-Tool.md
index 11336de..7df061f 100644
--- a/docs/zh/UserGuide/Maintenance-Tools/Metric-Tool.md
+++ b/docs/zh/UserGuide/Maintenance-Tools/Metric-Tool.md
@@ -78,62 +78,62 @@ IoTDB对外提供JMX和Prometheus格式的监控指标,对于JMX,可以通
| Metric | Tag | level | 说明 | 示例 |
| ------------------- | --------------- | ------ | ---------------- | -------------------------------------------- |
-| entry_seconds_count | name="接口名" | normal | 接口累计访问次数 | entry_seconds_count{name="openSession",} 1.0 |
-| entry_seconds_sum | name="接口名" | normal | 接口累计耗时(s) | entry_seconds_sum{name="openSession",} 0.024 |
-| entry_seconds_max | name="接口名" | normal | 接口最大耗时(s) | entry_seconds_max{name="openSession",} 0.024 |
-| quantity_total | name="pointsIn" | normal | 系统累计写入点数 | quantity_total{name="pointsIn",} 1.0 |
+| entry_seconds_count | name="接口名" | important | 接口累计访问次数 | entry_seconds_count{name="openSession",} 1.0 |
+| entry_seconds_sum | name="接口名" | important | 接口累计耗时(s) | entry_seconds_sum{name="openSession",} 0.024 |
+| entry_seconds_max | name="接口名" | important | 接口最大耗时(s) | entry_seconds_max{name="openSession",} 0.024 |
+| quantity_total | name="pointsIn" | important | 系统累计写入点数 | quantity_total{name="pointsIn",} 1.0 |
#### 4.3.2. 文件
| Metric | Tag | level | 说明 | 示例 |
| ---------- | -------------------- | ------ | ----------------------------------- | --------------------------- |
-| file_size | name="wal/seq/unseq" | normal | 当前时间wal/seq/unseq文件大小(byte) | file_size{name="wal",} 67.0 |
-| file_count | name="wal/seq/unseq" | normal | 当前时间wal/seq/unseq文件个数 | file_count{name="seq",} 1.0 |
+| file_size | name="wal/seq/unseq" | important | 当前时间wal/seq/unseq文件大小(byte) | file_size{name="wal",} 67.0 |
+| file_count | name="wal/seq/unseq" | important | 当前时间wal/seq/unseq文件个数 | file_count{name="seq",} 1.0 |
#### 4.3.3. Flush
| Metric | Tag | level | 说明 | 示例 |
| ----------------------- | ------------------------------------------- | ------ | -------------------------------- | --------------------------------------------------------------------------------------- |
-| queue | name="flush",<br />status="running/waiting" | normal | 当前时间flush任务数 | queue{name="flush",status="waiting",} 0.0<br/>queue{name="flush",status="running",} 0.0 |
-| cost_task_seconds_count | name="flush" | normal | flush累计发生次数 | cost_task_seconds_count{name="flush",} 1.0 |
-| cost_task_seconds_max | name="flush" | normal | 到目前为止flush耗时(s)最大的一次 | cost_task_seconds_max{name="flush",} 0.363 |
-| cost_task_seconds_sum | name="flush" | normal | flush累计耗时(s) | cost_task_seconds_sum{name="flush",} 0.363 |
+| queue | name="flush",<br />status="running/waiting" | important | 当前时间flush任务数 | queue{name="flush",status="waiting",} 0.0<br/>queue{name="flush",status="running",} 0.0 |
+| cost_task_seconds_count | name="flush" | important | flush累计发生次数 | cost_task_seconds_count{name="flush",} 1.0 |
+| cost_task_seconds_max | name="flush" | important | 到目前为止flush耗时(s)最大的一次 | cost_task_seconds_max{name="flush",} 0.363 |
+| cost_task_seconds_sum | name="flush" | important | flush累计耗时(s) | cost_task_seconds_sum{name="flush",} 0.363 |
#### 4.3.4. Compaction
| Metric | Tag | level | 说明 | 示例 |
| ----------------------- | ----------------------------------------------------------------------- | ------ | ------------------------------------- | ---------------------------------------------------- |
-| queue | name="compaction_inner/compaction_cross",<br />status="running/waiting" | normal | 当前时间compaction任务数 | queue{name="compaction_inner",status="waiting",} 0.0 |
-| cost_task_seconds_count | name="compaction" | normal | compaction累计发生次数 | cost_task_seconds_count{name="compaction",} 1.0 |
-| cost_task_seconds_max | name="compaction" | normal | 到目前为止compaction耗时(s)最大的一次 | cost_task_seconds_max{name="compaction",} 0.363 |
-| cost_task_seconds_sum | name="compaction" | normal | compaction累计耗时(s) | cost_task_seconds_sum{name="compaction",} 0.363 |
+| queue | name="compaction_inner/compaction_cross",<br />status="running/waiting" | important | 当前时间compaction任务数 | queue{name="compaction_inner",status="waiting",} 0.0 |
+| cost_task_seconds_count | name="compaction" | important | compaction累计发生次数 | cost_task_seconds_count{name="compaction",} 1.0 |
+| cost_task_seconds_max | name="compaction" | important | 到目前为止compaction耗时(s)最大的一次 | cost_task_seconds_max{name="compaction",} 0.363 |
+| cost_task_seconds_sum | name="compaction" | important | compaction累计耗时(s) | cost_task_seconds_sum{name="compaction",} 0.363 |
#### 4.3.5. 内存占用
| Metric | Tag | 说明 | level | 示例 |
| ------ | --------------------------------------- | ------ | -------------------------------------------------- | --------------------------------- |
-| mem | name="chunkMetaData/storageGroup/mtree" | normal | chunkMetaData/storageGroup/mtree占用的内存(byte) | mem{name="chunkMetaData",} 2050.0 |
+| mem | name="chunkMetaData/storageGroup/mtree" | important | chunkMetaData/storageGroup/mtree占用的内存(byte) | mem{name="chunkMetaData",} 2050.0 |
#### 4.3.6. 缓存命中率
| Metric | Tag | level | 说明 | 示例 |
| --------- | --------------------------------------- | ------ | ------------------------------------------------ | --------------------------- |
-| cache_hit | name="chunk/timeSeriesMeta/bloomFilter" | normal | chunk/timeSeriesMeta缓存命中率,bloomFilter拦截率 | cache_hit{name="chunk",} 80 |
+| cache_hit | name="chunk/timeSeriesMeta/bloomFilter" | important | chunk/timeSeriesMeta缓存命中率,bloomFilter拦截率 | cache_hit{name="chunk",} 80 |
#### 4.3.7. 业务数据
| Metric | Tag | level | 说明 | 示例 |
| -------- | ------------------------------------- | ------ | -------------------------------------------- | -------------------------------- |
-| quantity | name="timeSeries/storageGroup/device" | normal | 当前时间timeSeries/storageGroup/device的数量 | quantity{name="timeSeries",} 1.0 |
+| quantity | name="timeSeries/storageGroup/device" | important | 当前时间timeSeries/storageGroup/device的数量 | quantity{name="timeSeries",} 1.0 |
#### 4.3.8. 集群
| Metric | Tag | level | 说明 | 示例 |
| ------------------------- | ------------------------------- | ------ | ------------------------------------------------------------- | ---------------------------------------------------------------------------- |
-| cluster_node_leader_count | name="{{ip}}" | normal | 节点上```dataGroupLeader```的数量,用来观察leader是否分布均匀 | cluster_node_leader_count{name="127.0.0.1",} 2.0 |
-| cluster_uncommitted_log | name="{{ip_datagroupHeader}}" | normal | 节点```uncommitted_log```的数量 | cluster_uncommitted_log{name="127.0.0.1_Data-127.0.0.1-40010-raftId-0",} 0.0 |
-| cluster_node_status | name="{{ip}}" | normal | 节点状态,1=online 2=offline | cluster_node_status{name="127.0.0.1",} 1.0 |
-| cluster_elect_total | name="{{ip}}",status="fail/win" | normal | 节点参与选举的次数及结果 | cluster_elect_total{name="127.0.0.1",status="win",} 1.0 |
+| cluster_node_leader_count | name="{{ip}}" | important | 节点上```dataGroupLeader```的数量,用来观察leader是否分布均匀 | cluster_node_leader_count{name="127.0.0.1",} 2.0 |
+| cluster_uncommitted_log | name="{{ip_datagroupHeader}}" | important | 节点```uncommitted_log```的数量 | cluster_uncommitted_log{name="127.0.0.1_Data-127.0.0.1-40010-raftId-0",} 0.0 |
+| cluster_node_status | name="{{ip}}" | important | 节点状态,1=online 2=offline | cluster_node_status{name="127.0.0.1",} 1.0 |
+| cluster_elect_total | name="{{ip}}",status="fail/win" | important | 节点参与选举的次数及结果 | cluster_elect_total{name="127.0.0.1",status="win",} 1.0 |
### 4.4. IoTDB 预定义指标集
用户可以在`iotdb-metric.yml`文件中,修改`predefinedMetrics`的值来启用预定义指标集,其中`LOGBACK`在`dropwizard`中不支持。
@@ -188,7 +188,20 @@ IoTDB对外提供JMX和Prometheus格式的监控指标,对于JMX,可以通
| logback_events_total | {level="trace/debug/info/warn/error",} | trace/debug/info/warn/error日志累计数量 | logback_events_total{level="warn",} 0.0 |
### 4.5. 自定义添加埋点
-如果想自己在IoTDB中添加更多Metrics埋点,可以参考[IoTDB Metrics Framework](https://github.com/apache/iotdb/tree/master/metrics)使用说明
+- 如果想自己在IoTDB中添加更多Metrics埋点,可以参考[IoTDB Metrics Framework](https://github.com/apache/iotdb/tree/master/metrics)使用说明
+- Metric 埋点定义规则
+ - `Metric`:监控项的名称,比如`entry_seconds_count`为接口累计访问次数,file_size 为文件总数。
+ - `Tags`:Key-Value对,用来明确被监控项,可选项
+ - `name = xxx`:被监控项的名称,比如对`entry_seconds_count`这个监控项,name 的含义是被监控的接口名称。
+ - `status = xxx`:被监控项的状态细分,比如监控 Task 的监控项可以通过该参数,将运行的 Task 和停止的 Task 分开。
+ - `user = xxx`:被监控项和某个特定用户相关,比如统计root用户的写入总次数。
+ - 根据具体情况自定义......
+- 监控指标级别含义:
+ - 线上运行默认启动级别为`Important`级,线下调试默认启动级别为`Normal`级,审核严格程度`Core > Important > Normal > All`
+ - `Core`:系统的核心指标,供**运维人员**使用,关乎系统的**性能、稳定性、安全性**,比如实例的状况,系统的负载等。
+ - `Important`:模块的重要指标,供**运维和测试人员**使用,直接关乎**每个模块的运行状态**,比如合并文件个数、执行情况等。
+ - `Normal`:模块的一般指标,供**开发人员**使用,方便在出现问题时**定位模块**,比如合并中的特定关键操作情况。
+ - `All`:模块的全部指标,供**模块开发人员**使用,往往在复现问题的时候使用,从而快速解决问题。
## 5. 怎样获取这些metrics?
@@ -209,24 +222,17 @@ metricReporterList:
monitorType: MICROMETER
# 初始化metric的级别,可选参数: [CORE, IMPORTANT, NORMAL, ALL]
-metricLevel: NORMAL
+metricLevel: IMPORTANT
# 预定义的指标集, 可选参数: [JVM, LOGBACK], 其中LOGBACK在dropwizard中不支持
predefinedMetrics:
- JVM
-# 数据推送时间,该参数只对 monitorType=dropwizard生效
+# 数据推送时间,该参数只对 IoTDB Reporter 生效
pushPeriodInSecond: 5
-########################################################
-# #
-# if the reporter is prometheus, #
-# then the following must be set. #
-# #
-########################################################
-prometheusReporterConfig:
- prometheusExporterUrl: http://localhost
- prometheusExporterPort: 9091
+# Prometheus Reporter 使用的端口
+prometheusExporterPort: 9091
```
然后按照下面的操作获取metrics数据
diff --git a/metrics/ReadMe.md b/metrics/ReadMe.md
index 204be51..2b2ea63 100644
--- a/metrics/ReadMe.md
+++ b/metrics/ReadMe.md
@@ -128,7 +128,7 @@ public class PrometheusRunTest {
metricConfig.setPredefinedMetrics(new ArrayList<>());
metricService.startService();
metricManager = metricService.getMetricManager();
- Counter counter = metricManager.getOrCreateCounter("counter", MetricLevel.NORMAL);
+ Counter counter = metricManager.getOrCreateCounter("counter", MetricLevel.IMPORTANT);
while (true) {
counter.inc();
TimeUnit.SECONDS.sleep(1);
@@ -143,7 +143,7 @@ public class PrometheusRunTest {
```java
MetricsService.getInstance()
- .count(1, "operation_count", MetricLevel.NORMAL, "name", operation.getName());
+ .count(1, "operation_count", MetricLevel.IMPORTANT, "name", operation.getName());
```
# 4. How to implement your own metric framework?
diff --git a/metrics/dropwizard-metrics/src/test/java/org/apache/iotdb/metrics/dropwizard/DropwizardMetricManagerTest.java b/metrics/dropwizard-metrics/src/test/java/org/apache/iotdb/metrics/dropwizard/DropwizardMetricManagerTest.java
index 533ae3d..d23d69f 100644
--- a/metrics/dropwizard-metrics/src/test/java/org/apache/iotdb/metrics/dropwizard/DropwizardMetricManagerTest.java
+++ b/metrics/dropwizard-metrics/src/test/java/org/apache/iotdb/metrics/dropwizard/DropwizardMetricManagerTest.java
@@ -48,7 +48,7 @@ public class DropwizardMetricManagerTest {
public static void init() {
metricConfig.setEnableMetric(true);
metricConfig.setMonitorType(MonitorType.DROPWIZARD);
- metricConfig.setMetricLevel(MetricLevel.NORMAL);
+ metricConfig.setMetricLevel(MetricLevel.IMPORTANT);
metricConfig.setPredefinedMetrics(new ArrayList<>());
metricService.startService();
metricManager = metricService.getMetricManager();
@@ -57,17 +57,17 @@ public class DropwizardMetricManagerTest {
@Test
public void getOrCreateCounter() {
Counter counter1 =
- metricManager.getOrCreateCounter("counter_test", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.getOrCreateCounter("counter_test", MetricLevel.IMPORTANT, "tag1", "tag2");
assertNotNull(counter1);
Counter counter2 =
- metricManager.getOrCreateCounter("counter_test", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.getOrCreateCounter("counter_test", MetricLevel.IMPORTANT, "tag1", "tag2");
assertEquals(counter1, counter2);
}
private void getOrCreateDifferentMetricsWithSameName() {
- Timer timer = metricManager.getOrCreateTimer("metric", MetricLevel.NORMAL, "tag1", "tag2");
+ Timer timer = metricManager.getOrCreateTimer("metric", MetricLevel.IMPORTANT, "tag1", "tag2");
assertNotNull(timer);
- metricManager.getOrCreateCounter("metric", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.getOrCreateCounter("metric", MetricLevel.IMPORTANT, "tag1", "tag2");
}
@Test
@@ -77,9 +77,11 @@ public class DropwizardMetricManagerTest {
@Test
public void getOrCreateGauge() {
- Gauge gauge1 = metricManager.getOrCreateGauge("gauge_test", MetricLevel.NORMAL, "tag1", "tag2");
+ Gauge gauge1 =
+ metricManager.getOrCreateGauge("gauge_test", MetricLevel.IMPORTANT, "tag1", "tag2");
assertNotNull(gauge1);
- Gauge gauge2 = metricManager.getOrCreateGauge("gauge_test", MetricLevel.NORMAL, "tag1", "tag2");
+ Gauge gauge2 =
+ metricManager.getOrCreateGauge("gauge_test", MetricLevel.IMPORTANT, "tag1", "tag2");
assertEquals(gauge1, gauge2);
}
@@ -88,7 +90,7 @@ public class DropwizardMetricManagerTest {
List<Integer> list = new ArrayList<>();
Gauge autoGauge =
metricManager.getOrCreateAutoGauge(
- "autoGaugeMetric", MetricLevel.NORMAL, list, List::size, "tagk", "tagv");
+ "autoGaugeMetric", MetricLevel.IMPORTANT, list, List::size, "tagk", "tagv");
assertEquals(0L, autoGauge.value());
list.add(1);
assertEquals(1L, autoGauge.value());
@@ -103,77 +105,81 @@ public class DropwizardMetricManagerTest {
@Test
public void getOrCreateRate() {
- Rate rate1 = metricManager.getOrCreateRate("rate_test", MetricLevel.NORMAL, "tag1", "tag2");
+ Rate rate1 = metricManager.getOrCreateRate("rate_test", MetricLevel.IMPORTANT, "tag1", "tag2");
assertNotNull(rate1);
- Rate rate2 = metricManager.getOrCreateRate("rate_test", MetricLevel.NORMAL, "tag1", "tag2");
+ Rate rate2 = metricManager.getOrCreateRate("rate_test", MetricLevel.IMPORTANT, "tag1", "tag2");
assertEquals(rate1, rate2);
}
@Test
public void getOrCreateHistogram() {
Histogram histogram1 =
- metricManager.getOrCreateHistogram("histogram_test", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.getOrCreateHistogram("histogram_test", MetricLevel.IMPORTANT, "tag1", "tag2");
assertNotNull(histogram1);
Histogram histogram2 =
- metricManager.getOrCreateHistogram("histogram_test", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.getOrCreateHistogram("histogram_test", MetricLevel.IMPORTANT, "tag1", "tag2");
assertEquals(histogram1, histogram2);
}
@Test
public void getOrCreateTimer() {
- Timer timer1 = metricManager.getOrCreateTimer("timer_test", MetricLevel.NORMAL, "tag1", "tag2");
+ Timer timer1 =
+ metricManager.getOrCreateTimer("timer_test", MetricLevel.IMPORTANT, "tag1", "tag2");
assertNotNull(timer1);
- Timer timer2 = metricManager.getOrCreateTimer("timer_test", MetricLevel.NORMAL, "tag1", "tag2");
+ Timer timer2 =
+ metricManager.getOrCreateTimer("timer_test", MetricLevel.IMPORTANT, "tag1", "tag2");
assertEquals(timer1, timer2);
}
@Test
public void count() {
Counter counter =
- metricManager.getOrCreateCounter("count_inc", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.getOrCreateCounter("count_inc", MetricLevel.IMPORTANT, "tag1", "tag2");
assertNotNull(counter);
- metricManager.count(10, "count_inc", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.count(10, "count_inc", MetricLevel.IMPORTANT, "tag1", "tag2");
assertEquals(counter.count(), 10);
- metricManager.count(10L, "count_inc", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.count(10L, "count_inc", MetricLevel.IMPORTANT, "tag1", "tag2");
assertEquals(counter.count(), 20);
}
@Test
public void gauge() {
- Gauge gauge1 = metricManager.getOrCreateGauge("gauge_set1", MetricLevel.NORMAL, "tag1", "tag2");
+ Gauge gauge1 =
+ metricManager.getOrCreateGauge("gauge_set1", MetricLevel.IMPORTANT, "tag1", "tag2");
assertNotNull(gauge1);
- metricManager.gauge(10, "gauge_set1", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.gauge(10, "gauge_set1", MetricLevel.IMPORTANT, "tag1", "tag2");
assertEquals(10, gauge1.value());
- Gauge gauge2 = metricManager.getOrCreateGauge("gauge_set2", MetricLevel.NORMAL, "tag1", "tag2");
- metricManager.gauge(20L, "gauge_set2", MetricLevel.NORMAL, "tag1", "tag2");
+ Gauge gauge2 =
+ metricManager.getOrCreateGauge("gauge_set2", MetricLevel.IMPORTANT, "tag1", "tag2");
+ metricManager.gauge(20L, "gauge_set2", MetricLevel.IMPORTANT, "tag1", "tag2");
assertEquals(20, gauge2.value());
}
@Test
public void rate() {
- Rate rate = metricManager.getOrCreateRate("rate_mark", MetricLevel.NORMAL, "tag1", "tag2");
+ Rate rate = metricManager.getOrCreateRate("rate_mark", MetricLevel.IMPORTANT, "tag1", "tag2");
assertNotNull(rate);
- metricManager.rate(10, "rate_mark", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.rate(10, "rate_mark", MetricLevel.IMPORTANT, "tag1", "tag2");
assertEquals(10, rate.getCount());
- metricManager.rate(20L, "rate_mark", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.rate(20L, "rate_mark", MetricLevel.IMPORTANT, "tag1", "tag2");
assertEquals(30, rate.getCount());
}
@Test
public void histogram() {
Histogram histogram =
- metricManager.getOrCreateHistogram("history_count", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.getOrCreateHistogram("history_count", MetricLevel.IMPORTANT, "tag1", "tag2");
assertNotNull(histogram);
- metricManager.histogram(10, "history_count", MetricLevel.NORMAL, "tag1", "tag2");
- metricManager.histogram(20L, "history_count", MetricLevel.NORMAL, "tag1", "tag2");
- metricManager.histogram(30, "history_count", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.histogram(10, "history_count", MetricLevel.IMPORTANT, "tag1", "tag2");
+ metricManager.histogram(20L, "history_count", MetricLevel.IMPORTANT, "tag1", "tag2");
+ metricManager.histogram(30, "history_count", MetricLevel.IMPORTANT, "tag1", "tag2");
try {
Thread.sleep(1000);
} catch (Exception e) {
// do nothing
}
- metricManager.histogram(40L, "history_count", MetricLevel.NORMAL, "tag1", "tag2");
- metricManager.histogram(50, "history_count", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.histogram(40L, "history_count", MetricLevel.IMPORTANT, "tag1", "tag2");
+ metricManager.histogram(50, "history_count", MetricLevel.IMPORTANT, "tag1", "tag2");
assertEquals(5, histogram.count());
assertEquals(5, histogram.takeSnapshot().size());
assertEquals(10, histogram.takeSnapshot().getMin());
@@ -184,18 +190,19 @@ public class DropwizardMetricManagerTest {
@Test
public void timer() {
- Timer timer = metricManager.getOrCreateTimer("timer_mark", MetricLevel.NORMAL, "tag1", "tag2");
- metricManager.timer(2L, TimeUnit.MINUTES, "timer_mark", MetricLevel.NORMAL, "tag1", "tag2");
+ Timer timer =
+ metricManager.getOrCreateTimer("timer_mark", MetricLevel.IMPORTANT, "tag1", "tag2");
+ metricManager.timer(2L, TimeUnit.MINUTES, "timer_mark", MetricLevel.IMPORTANT, "tag1", "tag2");
metricManager.timer(
- 4L, TimeUnit.MINUTES, "timer_" + "mark", MetricLevel.NORMAL, "tag1", "tag2");
- metricManager.timer(6L, TimeUnit.MINUTES, "timer_mark", MetricLevel.NORMAL, "tag1", "tag2");
+ 4L, TimeUnit.MINUTES, "timer_" + "mark", MetricLevel.IMPORTANT, "tag1", "tag2");
+ metricManager.timer(6L, TimeUnit.MINUTES, "timer_mark", MetricLevel.IMPORTANT, "tag1", "tag2");
try {
Thread.sleep(1000);
} catch (Exception e) {
// do nothing
}
- metricManager.timer(8L, TimeUnit.MINUTES, "timer_mark", MetricLevel.NORMAL, "tag1", "tag2");
- metricManager.timer(10L, TimeUnit.MINUTES, "timer_mark", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.timer(8L, TimeUnit.MINUTES, "timer_mark", MetricLevel.IMPORTANT, "tag1", "tag2");
+ metricManager.timer(10L, TimeUnit.MINUTES, "timer_mark", MetricLevel.IMPORTANT, "tag1", "tag2");
assertEquals(5, timer.getImmutableRate().getCount());
assertEquals(5, timer.takeSnapshot().size());
assertEquals(120000000000L, timer.takeSnapshot().getMin());
@@ -207,54 +214,58 @@ public class DropwizardMetricManagerTest {
@Test
public void removeCounter() {
Counter counter1 =
- metricManager.getOrCreateCounter("counter_remove", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.getOrCreateCounter("counter_remove", MetricLevel.IMPORTANT, "tag1", "tag2");
metricManager.removeCounter("counter_remove", "tag1", "tag2");
Counter counter2 =
- metricManager.getOrCreateCounter("counter_remove", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.getOrCreateCounter("counter_remove", MetricLevel.IMPORTANT, "tag1", "tag2");
assertNotEquals(counter1, counter2);
}
@Test
public void removeGauge() {
Gauge gauge1 =
- metricManager.getOrCreateGauge("gauge_remove", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.getOrCreateGauge("gauge_remove", MetricLevel.IMPORTANT, "tag1", "tag2");
metricManager.removeGauge("gauge_remove", "tag1", "tag2");
Gauge gauge2 =
- metricManager.getOrCreateGauge("gauge_remove", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.getOrCreateGauge("gauge_remove", MetricLevel.IMPORTANT, "tag1", "tag2");
assertNotEquals(gauge1, gauge2);
}
@Test
public void removeRate() {
- Rate rate1 = metricManager.getOrCreateRate("rate_remove", MetricLevel.NORMAL, "tag1", "tag2");
+ Rate rate1 =
+ metricManager.getOrCreateRate("rate_remove", MetricLevel.IMPORTANT, "tag1", "tag2");
metricManager.removeRate("rate_remove", "tag1", "tag2");
- Rate rate2 = metricManager.getOrCreateRate("rate_remove", MetricLevel.NORMAL, "tag1", "tag2");
+ Rate rate2 =
+ metricManager.getOrCreateRate("rate_remove", MetricLevel.IMPORTANT, "tag1", "tag2");
assertNotEquals(rate1, rate2);
}
@Test
public void removeHistogram() {
Histogram histogram1 =
- metricManager.getOrCreateHistogram("histogram_remove", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.getOrCreateHistogram(
+ "histogram_remove", MetricLevel.IMPORTANT, "tag1", "tag2");
metricManager.removeHistogram("histogram_remove", "tag1", "tag2");
Histogram histogram2 =
- metricManager.getOrCreateHistogram("histogram_remove", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.getOrCreateHistogram(
+ "histogram_remove", MetricLevel.IMPORTANT, "tag1", "tag2");
assertNotEquals(histogram1, histogram2);
}
@Test
public void removeTimer() {
Timer timer1 =
- metricManager.getOrCreateTimer("timer_remove", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.getOrCreateTimer("timer_remove", MetricLevel.IMPORTANT, "tag1", "tag2");
metricManager.removeTimer("timer_remove", "tag1", "tag2");
Timer timer2 =
- metricManager.getOrCreateTimer("timer_remove", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.getOrCreateTimer("timer_remove", MetricLevel.IMPORTANT, "tag1", "tag2");
assertNotEquals(timer1, timer2);
}
@Test
public void getAllMetricKeys() {
- metricManager.getOrCreateCounter("metric_test", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.getOrCreateCounter("metric_test", MetricLevel.IMPORTANT, "tag1", "tag2");
List<String[]> result = metricManager.getAllMetricKeys();
assertNotNull(result);
boolean isContains = false;
@@ -269,7 +280,7 @@ public class DropwizardMetricManagerTest {
@Test
public void getAllCounters() {
- metricManager.getOrCreateCounter("counters", MetricLevel.NORMAL);
+ metricManager.getOrCreateCounter("counters", MetricLevel.IMPORTANT);
Map<String[], Counter> counters = metricManager.getAllCounters();
assertNotNull(counters);
assertTrue(counters.size() > 0);
@@ -277,7 +288,7 @@ public class DropwizardMetricManagerTest {
@Test
public void getAllGauges() {
- metricManager.getOrCreateGauge("gauges", MetricLevel.NORMAL);
+ metricManager.getOrCreateGauge("gauges", MetricLevel.IMPORTANT);
Map<String[], Gauge> gauges = metricManager.getAllGauges();
assertNotNull(gauges);
assertTrue(gauges.size() > 0);
@@ -285,7 +296,7 @@ public class DropwizardMetricManagerTest {
@Test
public void getAllRates() {
- metricManager.getOrCreateRate("rates", MetricLevel.NORMAL);
+ metricManager.getOrCreateRate("rates", MetricLevel.IMPORTANT);
Map<String[], Rate> rates = metricManager.getAllRates();
assertNotNull(rates);
assertTrue(rates.size() > 0);
@@ -293,7 +304,7 @@ public class DropwizardMetricManagerTest {
@Test
public void getAllHistograms() {
- metricManager.getOrCreateHistogram("histograms", MetricLevel.NORMAL);
+ metricManager.getOrCreateHistogram("histograms", MetricLevel.IMPORTANT);
Map<String[], Histogram> histograms = metricManager.getAllHistograms();
assertNotNull(histograms);
assertTrue(histograms.size() > 0);
@@ -301,7 +312,7 @@ public class DropwizardMetricManagerTest {
@Test
public void getAllTimers() {
- metricManager.getOrCreateTimer("timers", MetricLevel.NORMAL);
+ metricManager.getOrCreateTimer("timers", MetricLevel.IMPORTANT);
Map<String[], Timer> timers = metricManager.getAllTimers();
assertNotNull(timers);
assertTrue(timers.size() > 0);
@@ -310,7 +321,7 @@ public class DropwizardMetricManagerTest {
@Test
public void isEnable() {
assertTrue(metricManager.isEnable());
- assertTrue(metricManager.isEnable(MetricLevel.NORMAL));
+ assertTrue(metricManager.isEnable(MetricLevel.IMPORTANT));
}
@AfterClass
diff --git a/metrics/interface/src/main/assembly/resources/conf/iotdb-metric.yml b/metrics/interface/src/main/assembly/resources/conf/iotdb-metric.yml
index 6cd86a0..41c23fe 100644
--- a/metrics/interface/src/main/assembly/resources/conf/iotdb-metric.yml
+++ b/metrics/interface/src/main/assembly/resources/conf/iotdb-metric.yml
@@ -29,13 +29,13 @@ metricReporterList:
monitorType: MICROMETER
# Level of metric level, options: [CORE, IMPORTANT, NORMAL, ALL]
-metricLevel: NORMAL
+metricLevel: IMPORTANT
# Predefined metric, options: [JVM, LOGBACK], LOGBACK are not supported in dropwizard
predefinedMetrics:
- JVM
-# Period time of push, only valid for dropwizard
+# Period time of push, only used by IoTDB Reporter
pushPeriodInSecond: 5
# The http server's port for prometheus exporter to get metric data.
diff --git a/metrics/interface/src/main/java/org/apache/iotdb/metrics/config/MetricConfig.java b/metrics/interface/src/main/java/org/apache/iotdb/metrics/config/MetricConfig.java
index 249aa59..71cd304 100644
--- a/metrics/interface/src/main/java/org/apache/iotdb/metrics/config/MetricConfig.java
+++ b/metrics/interface/src/main/java/org/apache/iotdb/metrics/config/MetricConfig.java
@@ -42,7 +42,7 @@ public class MetricConfig {
private List<ReporterType> metricReporterList =
Arrays.asList(ReporterType.JMX, ReporterType.PROMETHEUS);
- private MetricLevel metricLevel = MetricLevel.NORMAL;
+ private MetricLevel metricLevel = MetricLevel.IMPORTANT;
private List<PredefinedMetric> predefinedMetrics =
Collections.singletonList(PredefinedMetric.JVM);
diff --git a/metrics/interface/src/test/java/org/apache/iotdb/metrics/config/MetricConfigTest.java b/metrics/interface/src/test/java/org/apache/iotdb/metrics/config/MetricConfigTest.java
index ddf745e..eb3abea 100644
--- a/metrics/interface/src/test/java/org/apache/iotdb/metrics/config/MetricConfigTest.java
+++ b/metrics/interface/src/test/java/org/apache/iotdb/metrics/config/MetricConfigTest.java
@@ -54,7 +54,7 @@ public class MetricConfigTest {
List<ReporterType> lists = metricConfig.getMetricReporterList();
Assert.assertEquals(lists.size(), 2);
Assert.assertEquals(metricConfig.getPrometheusExporterPort(), "9091");
- Assert.assertEquals(MetricLevel.NORMAL, metricConfig.getMetricLevel());
+ Assert.assertEquals(MetricLevel.IMPORTANT, metricConfig.getMetricLevel());
List<PredefinedMetric> predefinedMetrics = metricConfig.getPredefinedMetrics();
Assert.assertEquals(predefinedMetrics.size(), 1);
}
diff --git a/metrics/interface/src/test/resources/iotdb-metric.yml b/metrics/interface/src/test/resources/iotdb-metric.yml
index 6cd86a0..41c23fe 100644
--- a/metrics/interface/src/test/resources/iotdb-metric.yml
+++ b/metrics/interface/src/test/resources/iotdb-metric.yml
@@ -29,13 +29,13 @@ metricReporterList:
monitorType: MICROMETER
# Level of metric level, options: [CORE, IMPORTANT, NORMAL, ALL]
-metricLevel: NORMAL
+metricLevel: IMPORTANT
# Predefined metric, options: [JVM, LOGBACK], LOGBACK are not supported in dropwizard
predefinedMetrics:
- JVM
-# Period time of push, only valid for dropwizard
+# Period time of push, only used by IoTDB Reporter
pushPeriodInSecond: 5
# The http server's port for prometheus exporter to get metric data.
diff --git a/metrics/micrometer-metrics/src/test/java/org/apache/iotdb/metrics/micrometer/MicrometerMetricManagerTest.java b/metrics/micrometer-metrics/src/test/java/org/apache/iotdb/metrics/micrometer/MicrometerMetricManagerTest.java
index c76e8c3..6e6a803 100644
--- a/metrics/micrometer-metrics/src/test/java/org/apache/iotdb/metrics/micrometer/MicrometerMetricManagerTest.java
+++ b/metrics/micrometer-metrics/src/test/java/org/apache/iotdb/metrics/micrometer/MicrometerMetricManagerTest.java
@@ -53,9 +53,9 @@ public class MicrometerMetricManagerTest {
}
private void getOrCreateDifferentMetricsWithSameName() {
- Timer timer = metricManager.getOrCreateTimer("metric", MetricLevel.NORMAL, "tag1", "tag2");
+ Timer timer = metricManager.getOrCreateTimer("metric", MetricLevel.IMPORTANT, "tag1", "tag2");
assertNotNull(timer);
- metricManager.getOrCreateCounter("metric", MetricLevel.NORMAL, "tag1", "tag2");
+ metricManager.getOrCreateCounter("metric", MetricLevel.IMPORTANT, "tag1", "tag2");
}
@Test
@@ -68,7 +68,7 @@ public class MicrometerMetricManagerTest {
List<Integer> list = new ArrayList<>();
Gauge autoGauge =
metricManager.getOrCreateAutoGauge(
- "autoGaugeMetric", MetricLevel.NORMAL, list, List::size, "tagk", "tagv");
+ "autoGaugeMetric", MetricLevel.IMPORTANT, list, List::size, "tagk", "tagv");
assertEquals(0L, autoGauge.value());
list.add(1);
assertEquals(1L, autoGauge.value());
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/cache/ChunkCache.java b/server/src/main/java/org/apache/iotdb/db/engine/cache/ChunkCache.java
index 908ec2f..4490734 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/cache/ChunkCache.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/cache/ChunkCache.java
@@ -92,7 +92,7 @@ public class ChunkCache {
.getMetricManager()
.getOrCreateAutoGauge(
Metric.CACHE_HIT.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
lruCache,
l -> (long) (l.stats().hitRate() * 100),
Tag.NAME.toString(),
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java b/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
index 97740a7..71c9086 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
@@ -114,7 +114,7 @@ public class TimeSeriesMetadataCache {
.getMetricManager()
.getOrCreateAutoGauge(
Metric.CACHE_HIT.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
lruCache,
l -> (long) (l.stats().hitRate() * 100),
Tag.NAME.toString(),
@@ -124,7 +124,7 @@ public class TimeSeriesMetadataCache {
.getMetricManager()
.getOrCreateAutoGauge(
Metric.CACHE_HIT.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
bloomFilterPreventCount,
prevent -> {
if (bloomFilterRequestCount.get() == 0L) {
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/compaction/CompactionTaskManager.java b/server/src/main/java/org/apache/iotdb/db/engine/compaction/CompactionTaskManager.java
index 82a47d0..3284379 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/compaction/CompactionTaskManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/compaction/CompactionTaskManager.java
@@ -300,7 +300,7 @@ public class CompactionTaskManager implements IService {
.getMetricManager()
.getOrCreateGauge(
Metric.QUEUE.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
Tag.NAME.toString(),
"compaction_" + taskType,
Tag.STATUS.toString(),
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/compaction/task/AbstractCompactionTask.java b/server/src/main/java/org/apache/iotdb/db/engine/compaction/task/AbstractCompactionTask.java
index 8e186d7..07135ab 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/compaction/task/AbstractCompactionTask.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/compaction/task/AbstractCompactionTask.java
@@ -81,7 +81,7 @@ public abstract class AbstractCompactionTask implements Callable<Void> {
System.currentTimeMillis() - startTime,
TimeUnit.MILLISECONDS,
Metric.COST_TASK.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
Tag.NAME.toString(),
"compaction");
}
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/flush/FlushManager.java b/server/src/main/java/org/apache/iotdb/db/engine/flush/FlushManager.java
index 359401c..01f4308 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/flush/FlushManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/flush/FlushManager.java
@@ -61,7 +61,7 @@ public class FlushManager implements FlushManagerMBean, IService {
.getMetricManager()
.getOrCreateAutoGauge(
Metric.QUEUE.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
flushPool,
AbstractPoolManager::getWaitingTasksNumber,
Tag.NAME.toString(),
@@ -72,7 +72,7 @@ public class FlushManager implements FlushManagerMBean, IService {
.getMetricManager()
.getOrCreateAutoGauge(
Metric.QUEUE.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
flushPool,
AbstractPoolManager::getWorkingTasksNumber,
Tag.NAME.toString(),
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/flush/MemTableFlushTask.java b/server/src/main/java/org/apache/iotdb/db/engine/flush/MemTableFlushTask.java
index bb26e7b..387c609 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/flush/MemTableFlushTask.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/flush/MemTableFlushTask.java
@@ -163,7 +163,7 @@ public class MemTableFlushTask {
System.currentTimeMillis() - start,
TimeUnit.MILLISECONDS,
Metric.COST_TASK.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
Tag.NAME.toString(),
"flush");
}
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/memtable/AbstractMemTable.java b/server/src/main/java/org/apache/iotdb/db/engine/memtable/AbstractMemTable.java
index 248a998..06706b1 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/memtable/AbstractMemTable.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/memtable/AbstractMemTable.java
@@ -174,7 +174,7 @@ public abstract class AbstractMemTable implements IMemTable {
.count(
pointsInserted,
Metric.QUANTITY.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
Tag.NAME.toString(),
METRIC_POINT_IN);
}
@@ -220,7 +220,7 @@ public abstract class AbstractMemTable implements IMemTable {
.count(
pointsInserted,
Metric.QUANTITY.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
Tag.NAME.toString(),
METRIC_POINT_IN);
}
@@ -243,7 +243,7 @@ public abstract class AbstractMemTable implements IMemTable {
.count(
pointsInserted,
Metric.QUANTITY.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
Tag.NAME.toString(),
METRIC_POINT_IN);
}
@@ -269,7 +269,7 @@ public abstract class AbstractMemTable implements IMemTable {
.count(
pointsInserted,
Metric.QUANTITY.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
Tag.NAME.toString(),
METRIC_POINT_IN);
}
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorInfo.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorInfo.java
index 2bd2f69..b4c24fc 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorInfo.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorInfo.java
@@ -47,7 +47,7 @@ public class TsFileProcessorInfo {
.getMetricManager()
.getOrCreateGauge(
Metric.MEM.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
Tag.NAME.toString(),
"chunkMetaData_"
+ storageGroupInfo.getVirtualStorageGroupProcessor().getLogicalStorageGroupName())
@@ -64,7 +64,7 @@ public class TsFileProcessorInfo {
.getMetricManager()
.getOrCreateGauge(
Metric.MEM.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
Tag.NAME.toString(),
"chunkMetaData_"
+ storageGroupInfo.getVirtualStorageGroupProcessor().getLogicalStorageGroupName())
@@ -80,7 +80,7 @@ public class TsFileProcessorInfo {
.getMetricManager()
.getOrCreateGauge(
Metric.MEM.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
Tag.NAME.toString(),
"chunkMetaData_"
+ storageGroupInfo.getVirtualStorageGroupProcessor().getLogicalStorageGroupName())
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/VirtualStorageGroupProcessor.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/VirtualStorageGroupProcessor.java
index 83f406d..c2e4c26 100755
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/VirtualStorageGroupProcessor.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/VirtualStorageGroupProcessor.java
@@ -411,7 +411,7 @@ public class VirtualStorageGroupProcessor {
.getMetricManager()
.getOrCreateAutoGauge(
Metric.MEM.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
storageGroupInfo,
StorageGroupInfo::getMemCost,
Tag.NAME.toString(),
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java b/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
index 561dc5a..981bff5 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
@@ -306,7 +306,7 @@ public class MManager {
.getMetricManager()
.getOrCreateAutoGauge(
Metric.MEM.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
mtree,
RamUsageEstimator::sizeOf,
Tag.NAME.toString(),
@@ -319,7 +319,7 @@ public class MManager {
.getMetricManager()
.getOrCreateAutoGauge(
Metric.QUANTITY.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
totalSeriesNumber,
AtomicLong::get,
Tag.NAME.toString(),
@@ -329,7 +329,7 @@ public class MManager {
.getMetricManager()
.getOrCreateAutoGauge(
Metric.QUANTITY.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
mtree,
tree -> {
try {
@@ -346,7 +346,7 @@ public class MManager {
.getMetricManager()
.getOrCreateAutoGauge(
Metric.QUANTITY.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
mtree,
tree -> {
try {
diff --git a/server/src/main/java/org/apache/iotdb/db/query/pool/RawQueryReadTaskPoolManager.java b/server/src/main/java/org/apache/iotdb/db/query/pool/RawQueryReadTaskPoolManager.java
index 4ac254a..b68acbb 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/pool/RawQueryReadTaskPoolManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/pool/RawQueryReadTaskPoolManager.java
@@ -56,7 +56,7 @@ public class RawQueryReadTaskPoolManager extends AbstractPoolManager {
.getMetricManager()
.getOrCreateAutoGauge(
Metric.QUEUE.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
pool,
p -> ((ThreadPoolExecutor) p).getActiveCount(),
Tag.NAME.toString(),
@@ -67,7 +67,7 @@ public class RawQueryReadTaskPoolManager extends AbstractPoolManager {
.getMetricManager()
.getOrCreateAutoGauge(
Metric.QUEUE.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
pool,
p -> ((ThreadPoolExecutor) p).getQueue().size(),
Tag.NAME.toString(),
diff --git a/server/src/main/java/org/apache/iotdb/db/service/metrics/MetricsService.java b/server/src/main/java/org/apache/iotdb/db/service/metrics/MetricsService.java
index 7e7b951..b46d560 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/metrics/MetricsService.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/metrics/MetricsService.java
@@ -84,7 +84,7 @@ public class MetricsService extends MetricService implements MetricsServiceMBean
String walDir = DirectoryManager.getInstance().getWALFolder();
metricManager.getOrCreateAutoGauge(
Metric.FILE_SIZE.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
walDir,
FileUtils::getDirSize,
Tag.NAME.toString(),
@@ -93,7 +93,7 @@ public class MetricsService extends MetricService implements MetricsServiceMBean
String[] dataDirs = IoTDBDescriptor.getInstance().getConfig().getDataDirs();
metricManager.getOrCreateAutoGauge(
Metric.FILE_SIZE.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
dataDirs,
value ->
Stream.of(value)
@@ -107,7 +107,7 @@ public class MetricsService extends MetricService implements MetricsServiceMBean
"seq");
metricManager.getOrCreateAutoGauge(
Metric.FILE_SIZE.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
dataDirs,
value ->
Stream.of(value)
@@ -121,7 +121,7 @@ public class MetricsService extends MetricService implements MetricsServiceMBean
"unseq");
metricManager.getOrCreateAutoGauge(
Metric.FILE_COUNT.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
walDir,
value -> {
File walFolder = new File(value);
@@ -134,7 +134,7 @@ public class MetricsService extends MetricService implements MetricsServiceMBean
"wal");
metricManager.getOrCreateAutoGauge(
Metric.FILE_COUNT.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
dataDirs,
value ->
Stream.of(value)
@@ -150,7 +150,7 @@ public class MetricsService extends MetricService implements MetricsServiceMBean
"seq");
metricManager.getOrCreateAutoGauge(
Metric.FILE_COUNT.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
dataDirs,
value ->
Stream.of(value)
diff --git a/server/src/main/java/org/apache/iotdb/db/service/thrift/ProcessorWithMetrics.java b/server/src/main/java/org/apache/iotdb/db/service/thrift/ProcessorWithMetrics.java
index 34fcfc8..4194b46 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/thrift/ProcessorWithMetrics.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/thrift/ProcessorWithMetrics.java
@@ -70,7 +70,7 @@ public class ProcessorWithMetrics extends Processor {
cost,
TimeUnit.MILLISECONDS,
Metric.ENTRY.toString(),
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
Tag.NAME.toString(),
msg.name);
}
diff --git a/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/TSServiceImpl.java b/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/TSServiceImpl.java
index af403cd..3f9dce6 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/TSServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/TSServiceImpl.java
@@ -2081,12 +2081,12 @@ public class TSServiceImpl implements TSIService.Iface {
.histogram(
System.currentTimeMillis() - startTime,
"operation_histogram",
- MetricLevel.NORMAL,
+ MetricLevel.IMPORTANT,
"name",
operation.getName());
MetricsService.getInstance()
.getMetricManager()
- .count(1, "operation_count", MetricLevel.NORMAL, "name", operation.getName());
+ .count(1, "operation_count", MetricLevel.IMPORTANT, "name", operation.getName());
}
}
}