You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: iotdb-core/metrics/ReadMe.md
+28-61Lines changed: 28 additions & 61 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,11 +20,11 @@
20
20
-->
21
21
Metric Module
22
22
23
-
- In this project, we provide interface and its implementation
23
+
- In this project, we provide the metrics interface and its default implementation
24
24
- metrics-interface
25
25
- metrics-core
26
-
-In each implementation, you can use several types of reporter to report metric
27
-
-Jmx Reporter
26
+
-The built-in implementation supports the following reporters
27
+
-JMX Reporter
28
28
- Prometheus Reporter
29
29
- IoTDB Reporter
30
30
@@ -43,7 +43,7 @@ Metric Module
43
43
# 1. Design
44
44
> The acquisition system consists of following four parts.
45
45
46
-
1. Metrics:Provide tools for collecting metric in different scenarios, including Counter, Gauge, Histogram, Timer and Rate, each with tags.
46
+
1. Metrics: Provide tools for collecting metrics in different scenarios, including Counter, AutoGauge, Gauge, Histogram, Timer and Rate, each with tags.
47
47
2. MetricManager
48
48
1. Provide functions such as create, query, update and remove metrics.
49
49
2. Provide its own start and stop methods.
@@ -57,76 +57,43 @@ Metric Module
57
57
3. Provide the ability to load metric sets.
58
58
4. Provide the access of metricManager and CompositeReporter.
59
59
60
-
# 2. Test Report
61
-
We implemented the monitoring framework mainly based on Micrometer, and tested the results as follows:
62
-
63
-
## 2.1. Test Environment
64
-
1. Processor:Inter(R) Core(TM) i7-1065G7 CPU
65
-
2. RAM: 32G
66
-
67
-
## 2.2. Test Metrics
68
-
1. We use a single thread to create counter and run the test cases. The test metrics as follows:
69
-
1. memory : Memory usage in MB.
70
-
2. create : The time required to create, in ms.
71
-
3. searchInorder : The time required for the sequential query, in ms.
72
-
4. searchDisorder : The time required for random queries in ms.
73
-
74
-
## 2.3. Test parameters
75
-
1. metric : test metric
76
-
2. name : The name of the test metric, unify to one length.
77
-
3. tag : The tag of the test metric, unify to one length.
78
-
4. metricNumberTotal:The number of metrics tested.
79
-
5. tagSingleNumber:Number of tags of the test metric.
80
-
6. tagTotalNumber:The number of tag pools, the default is 1000, all
81
-
7. tags are taken out of the tag pool.
82
-
8. searchNumber:The number of queries, the default is 1000000.
83
-
9. loop:The number of query loops, the default is 10.
|`cn_metric_prometheus_reporter_port`| Prometheus HTTP port for ConfigNode. |`9091`|
70
+
|`dn_metric_prometheus_reporter_port`| Prometheus HTTP port for DataNode. |`9092`|
107
71
108
-
3.More details, see User Doc.
72
+
More details, see the User Guide and the `iotdb-system.properties.template` file.
109
73
110
74
## 3.2. Use Guide in IoTDB Server Module
111
-
1.Now, MetricService is registered as IService in server and confignode module, you can simple set properties: `dn(cn)_enable_metric=true` to use metric service.
112
-
2. In server module you can easily use these metric by`MetricService.getInstance()`, for example:
75
+
1.`MetricService` is registered as an `IService` in both DataNode and ConfigNode modules. Enable it with `dn(cn)_enable_metric=true`.
76
+
2. In server-side code you can use metrics through`MetricService.getInstance()`, for example:
3. If you want to bind or remove a metric set, use `addMetricSet(IMetricSet)` and `removeMetricSet(IMetricSet)`.
83
+
118
84
# 4. How to implement your own metric framework?
119
-
1. implement your MetricService
120
-
1. You need to implement `reloadProperties` to reload properties when running.
121
-
2. implement your MetricManager
122
-
1. You need to implement your metric manager to manage the creation and deletion of your metrics
123
-
3. implement your reporter
124
-
1. You need to implement jmx reporter and prometheus reporter, notice that your jmx bean name should be unified as `org.apache.iotdb.metrics`
125
-
2. You need to create `src/main/resources/META-INF/services/org.apache.iotdb.metrics.Reporter`,and record your MetricManager class name in this file, such as `org.apache.iotdb.metrics.core.reporter.IoTDBJmxReporter`
126
-
4. implement your specific metric
127
-
1. They are counter, gauge, histogram, histogramSnapshot, rate and timer.
128
-
2. These metrics will be managed by your MetricManager, and reported by your reporter.
85
+
1. Implement your metric types and an `AbstractMetricManager`.
86
+
1. The built-in implementation provides Counter, AutoGauge, Gauge, Histogram, Rate and Timer.
87
+
2. Implement your reporters.
88
+
1. Implement `Reporter` for a general reporter.
89
+
2. Implement `JmxReporter` if you need JMX registration. The built-in JMX domain is `org.apache.iotdb.metrics`.
90
+
3. Wire your implementation into the server-side metric service.
91
+
1. The current `MetricService` directly loads `IoTDBMetricManager`, `IoTDBJmxReporter`, `PrometheusReporter` and `IoTDBSessionReporter` in `loadManager()` and `loadReporter()`.
92
+
2. If you replace the default framework, update the corresponding loading logic there.
93
+
4. Keep service descriptor files consistent if your packaging depends on them.
0 commit comments