mirror of https://github.com/apache/iotdb
baa9e5dd86 | ||
---|---|---|
.. | ||
core | ||
interface | ||
ReadMe.md | ||
pom.xml |
ReadMe.md
Metric Module
-
In this project, we provide interface and its implementation
- metrics-interface
- metrics-core
-
In each implementation, you can use several types of reporter to report metric
- Jmx Reporter
- Prometheus Reporter
- IoTDB Reporter
1. Design
The acquisition system consists of following four parts.
- Metrics:Provide tools for collecting metric in different scenarios, including Counter, Gauge, Histogram, Timer and Rate, each with tags.
- MetricManager
- Provide functions such as create, query, update and remove metrics.
- Provide its own start and stop methods.
- CompositeReporter
- Provide management of reporter.
- Provide metric value to other systems, such as Jmx, Prometheus, IoTDB, etc.
- Provide its own start and stop methods.
- MetricService
- Provide the start and stop method of metric service.
- Provide the ability to reload properties when running.
- Provide the ability to load metric sets.
- Provide the access of metricManager and CompositeReporter.
2. Test Report
We implemented the monitoring framework mainly based on Micrometer, and tested the results as follows:
2.1. Test Environment
- Processor:Inter(R) Core(TM) i7-1065G7 CPU
- RAM: 32G
2.2. Test Metrics
- We use a single thread to create counter and run the test cases. The test metrics as follows:
- memory : Memory usage in MB.
- create : The time required to create, in ms.
- searchInorder : The time required for the sequential query, in ms.
- searchDisorder : The time required for random queries in ms.
2.3. Test parameters
- metric : test metric
- name : The name of the test metric, unify to one length.
- tag : The tag of the test metric, unify to one length.
- metricNumberTotal:The number of metrics tested.
- tagSingleNumber:Number of tags of the test metric.
- tagTotalNumber:The number of tag pools, the default is 1000, all
- tags are taken out of the tag pool.
- searchNumber:The number of queries, the default is 1000000.
- loop:The number of query loops, the default is 10.
2.4. Test Result
3. How to use?
3.1. Configuration
- firstly, you need to set up some system property, for example:
System.setProperty("line.separator", "\n");
System.setProperty("IOTDB_CONF", "metrics/core/src/test/resources");
- Then, you can modify
iotdb-datanode.properties(iotdb-confignode.properties)
as you like, some details:
properties | meaning | example |
---|---|---|
dn(cn)_enable_metric | whether enable the module | true |
dn(cn)_enable_performance_stat | Is stat performance of operation latency | true |
dn(cn)_metric_reporter_list | the list of reporter | JMX, PROMETHEUS, IOTDB |
dn(cn)_metric_level | the init level of metrics | ALL, NORMAL, IMPORTANT, CORE |
dn(cn)_metric_async_collect_period | The period of the collection of some metrics in asynchronous way, such as tsfile size. | 5 |
- More details, see User Doc.
3.2. Use Guide in IoTDB Server Module
- 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. - In server module you can easily use these metric by
MetricService.getInstance()
, for example:
MetricService.getInstance().count(1, "operation_count", MetricLevel.IMPORTANT, "name", operation.getName());
4. How to implement your own metric framework?
- implement your MetricService
- You need to implement
reloadProperties
to reload properties when running.
- You need to implement
- implement your MetricManager
- You need to implement your metric manager to manage the creation and deletion of your metrics
- implement your reporter
- You need to implement jmx reporter and prometheus reporter, notice that your jmx bean name should be unified as
org.apache.iotdb.metrics
- 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 asorg.apache.iotdb.metrics.core.reporter.IoTDBJmxReporter
- You need to implement jmx reporter and prometheus reporter, notice that your jmx bean name should be unified as
- implement your specific metric
- They are counter, gauge, histogram, histogramSnapshot, rate and timer.
- These metrics will be managed by your MetricManager, and reported by your reporter.