You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "SpriCoder (via GitHub)" <gi...@apache.org> on 2024/12/27 02:52:03 UTC
[PR] Add High Level Memory Threshold Metrics [iotdb]
SpriCoder opened a new pull request, #14568:
URL: https://github.com/apache/iotdb/pull/14568
Add High-Level Memory Threshold Metrics(Total, Storage Engine, Query Engine, Schema Engine, Consensus, Stream Engine, Direct Buffer)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add High Level Memory Threshold Metrics [iotdb]
Posted by "OneSizeFitsQuorum (via GitHub)" <gi...@apache.org>.
OneSizeFitsQuorum merged PR #14568:
URL: https://github.com/apache/iotdb/pull/14568
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add High Level Memory Threshold Metrics [iotdb]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #14568:
URL: https://github.com/apache/iotdb/pull/14568#issuecomment-2563284324
## [Codecov](https://app.codecov.io/gh/apache/iotdb/pull/14568?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
Attention: Patch coverage is `3.07692%` with `126 lines` in your changes missing coverage. Please review.
> Project coverage is 39.40%. Comparing base [(`530dd0b`)](https://app.codecov.io/gh/apache/iotdb/commit/530dd0bc653b9c15ed1e814340c7b3e95132edf9?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`05b0757`)](https://app.codecov.io/gh/apache/iotdb/commit/05b0757a23f5d6b5046dcf531cc10ab959e7f838?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 3 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/iotdb/pull/14568?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...service/metrics/memory/ThresholdMemoryMetrics.java](https://app.codecov.io/gh/apache/iotdb/pull/14568?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fservice%2Fmetrics%2Fmemory%2FThresholdMemoryMetrics.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvc2VydmljZS9tZXRyaWNzL21lbW9yeS9UaHJlc2hvbGRNZW1vcnlNZXRyaWNzLmphdmE=) | 0.00% | [91 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/14568?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...otdb/db/service/metrics/DataNodeMetricsHelper.java](https://app.codecov.io/gh/apache/iotdb/pull/14568?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fservice%2Fmetrics%2FDataNodeMetricsHelper.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvc2VydmljZS9tZXRyaWNzL0RhdGFOb2RlTWV0cmljc0hlbHBlci5qYXZh) | 0.00% | [35 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/14568?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #14568 +/- ##
============================================
- Coverage 39.42% 39.40% -0.02%
Complexity 185 185
============================================
Files 4341 4342 +1
Lines 275397 275494 +97
Branches 33639 33639
============================================
- Hits 108566 108559 -7
- Misses 166831 166935 +104
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/iotdb/pull/14568?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add High Level Memory Threshold Metrics [iotdb]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #14568:
URL: https://github.com/apache/iotdb/pull/14568#issuecomment-2563262867
## [](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=14568) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=14568&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=14568&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_iotdb&pullRequest=14568&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=14568&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=14568&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=14568)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add High Level Memory Threshold Metrics [iotdb]
Posted by "SpriCoder (via GitHub)" <gi...@apache.org>.
SpriCoder commented on PR #14568:
URL: https://github.com/apache/iotdb/pull/14568#issuecomment-2563270893
Panel:

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add High Level Memory Threshold Metrics [iotdb]
Posted by "OneSizeFitsQuorum (via GitHub)" <gi...@apache.org>.
OneSizeFitsQuorum commented on code in PR #14568:
URL: https://github.com/apache/iotdb/pull/14568#discussion_r1898536278
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/memory/ThresholdMemoryMetrics.java:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.service.metrics.memory;
+
+import org.apache.iotdb.commons.service.metric.enums.Metric;
+import org.apache.iotdb.commons.service.metric.enums.Tag;
+import org.apache.iotdb.db.conf.IoTDBConfig;
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.storageengine.rescon.memory.SystemInfo;
+import org.apache.iotdb.metrics.AbstractMetricService;
+import org.apache.iotdb.metrics.metricsets.IMetricSet;
+import org.apache.iotdb.metrics.utils.MetricLevel;
+import org.apache.iotdb.metrics.utils.MetricType;
+
+public class ThresholdMemoryMetrics implements IMetricSet {
+ private static final IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
+ private static final SystemInfo systemInfo = SystemInfo.getInstance();
+
+ @Override
+ public void bindTo(AbstractMetricService metricService) {
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "Total",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "0")
+ .set(Runtime.getRuntime().maxMemory());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "StorageEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(config.getAllocateMemoryForStorageEngine());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "QueryEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(config.getAllocateMemoryForRead());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "SchemaEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(config.getAllocateMemoryForSchema());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "Consensus",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(config.getAllocateMemoryForConsensus());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "StreamEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(config.getAllocateMemoryForPipe());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "DirectBuffer",
+ Tag.TYPE.toString(),
+ "OffHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(systemInfo.getTotalDirectBufferMemorySizeLimit());
+ }
+
+ @Override
+ public void unbindFrom(AbstractMetricService metricService) {
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "Total",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "0");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "StorageEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "QueryEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "SchemaEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "Consensus",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "StreamEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "DirectBuffer",
+ Tag.TYPE.toString(),
+ "OffHeap",
+ Tag.LEVEL.toString(),
+ "1");
Review Comment:
You could put define some field for these magic level string
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/memory/ThresholdMemoryMetrics.java:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.service.metrics.memory;
+
+import org.apache.iotdb.commons.service.metric.enums.Metric;
+import org.apache.iotdb.commons.service.metric.enums.Tag;
+import org.apache.iotdb.db.conf.IoTDBConfig;
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.storageengine.rescon.memory.SystemInfo;
+import org.apache.iotdb.metrics.AbstractMetricService;
+import org.apache.iotdb.metrics.metricsets.IMetricSet;
+import org.apache.iotdb.metrics.utils.MetricLevel;
+import org.apache.iotdb.metrics.utils.MetricType;
+
+public class ThresholdMemoryMetrics implements IMetricSet {
+ private static final IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
+ private static final SystemInfo systemInfo = SystemInfo.getInstance();
+
+ @Override
+ public void bindTo(AbstractMetricService metricService) {
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "Total",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "0")
+ .set(Runtime.getRuntime().maxMemory());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "StorageEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(config.getAllocateMemoryForStorageEngine());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "QueryEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(config.getAllocateMemoryForRead());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "SchemaEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(config.getAllocateMemoryForSchema());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "Consensus",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(config.getAllocateMemoryForConsensus());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "StreamEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(config.getAllocateMemoryForPipe());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "DirectBuffer",
+ Tag.TYPE.toString(),
+ "OffHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(systemInfo.getTotalDirectBufferMemorySizeLimit());
+ }
+
+ @Override
+ public void unbindFrom(AbstractMetricService metricService) {
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "Total",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "0");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "StorageEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "QueryEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "SchemaEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "Consensus",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "StreamEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "DirectBuffer",
+ Tag.TYPE.toString(),
+ "OffHeap",
+ Tag.LEVEL.toString(),
+ "1");
Review Comment:
You could define some field for these magic level stringļ¼could do it in next pr
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/memory/ThresholdMemoryMetrics.java:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.service.metrics.memory;
+
+import org.apache.iotdb.commons.service.metric.enums.Metric;
+import org.apache.iotdb.commons.service.metric.enums.Tag;
+import org.apache.iotdb.db.conf.IoTDBConfig;
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.storageengine.rescon.memory.SystemInfo;
+import org.apache.iotdb.metrics.AbstractMetricService;
+import org.apache.iotdb.metrics.metricsets.IMetricSet;
+import org.apache.iotdb.metrics.utils.MetricLevel;
+import org.apache.iotdb.metrics.utils.MetricType;
+
+public class ThresholdMemoryMetrics implements IMetricSet {
+ private static final IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
+ private static final SystemInfo systemInfo = SystemInfo.getInstance();
+
+ @Override
+ public void bindTo(AbstractMetricService metricService) {
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "Total",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "0")
+ .set(Runtime.getRuntime().maxMemory());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "StorageEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(config.getAllocateMemoryForStorageEngine());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "QueryEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(config.getAllocateMemoryForRead());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "SchemaEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(config.getAllocateMemoryForSchema());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "Consensus",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(config.getAllocateMemoryForConsensus());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "StreamEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(config.getAllocateMemoryForPipe());
+ metricService
+ .getOrCreateGauge(
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ MetricLevel.NORMAL,
+ Tag.NAME.toString(),
+ "DirectBuffer",
+ Tag.TYPE.toString(),
+ "OffHeap",
+ Tag.LEVEL.toString(),
+ "1")
+ .set(systemInfo.getTotalDirectBufferMemorySizeLimit());
+ }
+
+ @Override
+ public void unbindFrom(AbstractMetricService metricService) {
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "Total",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "0");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "StorageEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "QueryEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "SchemaEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "Consensus",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "StreamEngine",
+ Tag.TYPE.toString(),
+ "OnHeap",
+ Tag.LEVEL.toString(),
+ "1");
+ metricService.remove(
+ MetricType.GAUGE,
+ Metric.THRESHOLD_MEMORY_SIZE.toString(),
+ Tag.NAME.toString(),
+ "DirectBuffer",
+ Tag.TYPE.toString(),
+ "OffHeap",
+ Tag.LEVEL.toString(),
+ "1");
Review Comment:
You could put define some field for these magic level string
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org