szetszwo commented on code in PR #4112:
URL: https://github.com/apache/ozone/pull/4112#discussion_r1053191926
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/http/RatisDropwizardExports.java:
##########
@@ -43,21 +47,34 @@ public RatisDropwizardExports(MetricRegistry registry) {
super(registry, new RatisNameRewriteSampleBuilder());
}
- public static void registerRatisMetricReporters(
+ public static List<Pair<Consumer<RatisMetricRegistry>,
+ Consumer<RatisMetricRegistry>>> registerRatisMetricReporters(
Review Comment:
Add a new class. Then, the code will be shorter and easier to understand:
```java
public static class ReporterStopper {
private final Consumer<RatisMetricRegistry> reporter;
private final Consumer<RatisMetricRegistry> stopper;
ReporterStopper(Consumer<RatisMetricRegistry> reporter,
Consumer<RatisMetricRegistry> stopper) {
this.reporter = reporter;
this.stopper = stopper;
}
void addToGlobalRegistration() {
MetricRegistries.global().addReporterRegistration(reporter, stopper);
}
void removeFromGlobalRegistration() {
MetricRegistries.global().removeReporterRegistration(reporter,
stopper);
}
}
```
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/HddsDatanodeService.java:
##########
@@ -114,6 +117,8 @@ public class HddsDatanodeService extends GenericCli
implements ServicePlugin {
new DNMXBeanImpl(HddsVersionInfo.HDDS_VERSION_INFO) { };
private ObjectName dnInfoBeanName;
private DatanodeCRLStore dnCRLStore;
+ private List<Pair<Consumer<RatisMetricRegistry>,
+ Consumer<RatisMetricRegistry>>> ratisRegistryList = null;
Review Comment:
Please move it next to `ratisMetricsMap` since they are closely related.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -417,6 +420,8 @@ public final class OzoneManager extends
ServiceRuntimeInfoImpl
private final OzoneLockProvider ozoneLockProvider;
private OMPerformanceMetrics perfMetrics;
+ private List<Pair<Consumer<RatisMetricRegistry>,
+ Consumer<RatisMetricRegistry>>> ratisRegistryList = null;
Review Comment:
Please move it next to `ratisMetricsMap` since they are closely related.
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java:
##########
@@ -284,7 +286,9 @@ public final class StorageContainerManager extends
ServiceRuntimeInfoImpl
// container replicas.
private ContainerReplicaPendingOps containerReplicaPendingOps;
private final AtomicBoolean isStopped = new AtomicBoolean(false);
-
+ private List<Pair<Consumer<RatisMetricRegistry>,
+ Consumer<RatisMetricRegistry>>> ratisRegistryList = null;
Review Comment:
Please move it next to `ratisMetricsMap` since they are closely related.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]