adoroszlai commented on code in PR #9819:
URL: https://github.com/apache/ozone/pull/9819#discussion_r2883904917
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisor.java:
##########
@@ -247,19 +250,36 @@ private boolean queueHasRoomFor(AbstractReplicationTask
task) {
return true;
}
+ private void initAllTaskCounters() {
+ initCounters(ReplicationTask.METRIC_NAME,
+ ReplicationTask.METRIC_DESCRIPTION_SEGMENT,
+ ReplicationTask.class.getSimpleName());
+ initCounters(ECReconstructionCoordinatorTask.METRIC_NAME,
+ ECReconstructionCoordinatorTask.METRIC_DESCRIPTION_SEGMENT,
+ ECReconstructionCoordinatorTask.class.getSimpleName());
+ initCounters(ReconcileContainerTask.METRIC_NAME,
+ ReconcileContainerTask.METRIC_DESCRIPTION_SEGMENT,
+ ReconcileContainerTask.class.getSimpleName());
+ }
+
public void initCounters(AbstractReplicationTask task) {
- if (requestCounter.get(task.getMetricName()) == null) {
+ initCounters(task.getMetricName(), task.getMetricDescriptionSegment(),
+ task.getClass().getSimpleName());
+ }
+
+ public void initCounters(String metricName, String metricDescriptionSegment,
+ String taskSimpleName) {
Review Comment:
I think it would be better to pass the class itself instead of its name.
This would retain previous behavior of not having to call `getSimpleName()` for
each task in the common case that metrics are already initialized.
--
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]