SpriCoder commented on code in PR #9140:
URL: https://github.com/apache/iotdb/pull/9140#discussion_r1117046797
##########
consensus/src/main/java/org/apache/iotdb/consensus/ratis/metrics/RatisMetricSet.java:
##########
@@ -18,21 +18,36 @@
*/
package org.apache.iotdb.consensus.ratis.metrics;
+import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType;
import org.apache.iotdb.metrics.AbstractMetricService;
import org.apache.iotdb.metrics.metricsets.IMetricSet;
import org.apache.ratis.metrics.MetricRegistries;
public class RatisMetricSet implements IMetricSet {
private MetricRegistries manager;
+ private String consensusGroupType;
@Override
public void bindTo(AbstractMetricService metricService) {
manager = MetricRegistries.global();
+ if (manager instanceof MetricRegistryManager) {
+ ((MetricRegistryManager)
manager).setConsensusGroupType(consensusGroupType);
+ }
}
@Override
public void unbindFrom(AbstractMetricService metricService) {
manager.clear();
}
+
+ public void setConsensusGroupType(TConsensusGroupType consensusGroupType) {
+ if (consensusGroupType == TConsensusGroupType.ConfigNodeRegion) {
+ this.consensusGroupType = "confignode";
+ } else if (consensusGroupType == TConsensusGroupType.DataRegion) {
+ this.consensusGroupType = "data_region";
+ } else {
+ this.consensusGroupType = "schema_region";
+ }
+ }
Review Comment:
May be use enum class can be a good idea
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]