smengcl commented on code in PR #10763:
URL: https://github.com/apache/ozone/pull/10763#discussion_r4560744441


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconStorageContainerManagerFacade.java:
##########
@@ -377,7 +378,8 @@ public 
ReconStorageContainerManagerFacade(OzoneConfiguration conf,
 
     // Use a version manager with no upgrade actions. The version will only be 
used to track Datanode versions,
     // not run SCM specific reformatting on upgrade.
-    this.scmVersionManager = new ScmVersionManager(scmStorageConfig, this, 
HashMap::new);
+    this.scmVersionManager = new ScmVersionManager(scmStorageConfig, this, 
HashMap::new,
+        MetricUtil.metricsSourceComponent(conf, "ReconSCM"));

Review Comment:
   Thanks, this is addressed in d523afb: 
`ReconStorageContainerManagerFacade.stop()` now closes `scmVersionManager`. 
`TestLocalOzoneRecon#reconVersionMetricsUnregisterOnCloseAndRebindOnSecondStart`
 checks that the `ReconSCM` source is gone after close and that a second start 
registers a new one. After the latest master merge the source is named 
`ComponentVersionManagerMetrics-ReconSCM`.
   



##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/LocalOzoneCluster.java:
##########
@@ -714,6 +715,12 @@ private int configureS3Gateway(OzoneConfiguration conf, 
PersistedPortState persi
     if (!config.isS3gEnabled()) {
       return -1;
     }
+    // getS3Endpoint() advertises the HTTP listener, which a policy without 
HTTP leaves unbound.
+    HttpConfig.Policy httpPolicy =

Review Comment:
   This one is resolved by the master merge. HDDS-14932 (#10760) put the 
`(config.isS3gEnabled() || config.isReconEnabled())` HTTP policy check back in 
`configureLocalDefaults()`, along with 
`prepareConfigurationChecksHttpPolicyForRecon`. This PR no longer changes that 
code.
   



##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/util/MetricUtil.java:
##########
@@ -110,6 +114,28 @@ public static List<MutableQuantiles> 
createQuantiles(MetricsRegistry registry,
     }).collect(Collectors.toList());
   }
 
+  /**
+   * Qualifies a metrics-source name with a per-instance component, per
+   * {@link 
org.apache.hadoop.hdds.HddsConfigKeys#HDDS_METRICS_SOURCE_DISAMBIGUATION_ENABLED}.
+   * A null or empty {@code component} leaves standalone services on their 
original names.
+   * Non-alphanumeric characters are dropped from {@code component}, so the 
datanode UUID
+   * {@code abc-123} yields {@code <base>.abc123}. Recon resolves datanode 
metrics by these bean
+   * names, so the spelling is a contract rather than cosmetic.
+   */
+  public static String qualifySourceName(String base, String component) {
+    return component == null || component.isEmpty() ? base
+        : base + "." + component.replaceAll("[^A-Za-z0-9]+", "");
+  }
+
+  /**
+   * Intended as the argument for {@link #qualifySourceName(String, 
String)}-based factory
+   * methods, so a call site passes a component without testing the key itself.
+   */
+  public static String metricsSourceComponent(ConfigurationSource conf, String 
component) {
+    return conf.getBoolean(HDDS_METRICS_SOURCE_DISAMBIGUATION_ENABLED,
+        HDDS_METRICS_SOURCE_DISAMBIGUATION_ENABLED_DEFAULT) ? component : null;
+  }

Review Comment:
   Thanks for the suggestion, agreed. HDDS-15960 (#10941) has since added a 
one-step `MetricUtil.getMetricsSourceName(base, id)`. d809dd3 drops 
`qualifySourceName` and `metricsSourceComponent` and uses that helper 
everywhere, so callers pass the instance ID (datanode UUID, SCM ID, OM node ID) 
and nothing passes null.
   
   The mini-cluster check now happens in that one helper, and production source 
names are unchanged. Names in shared-JVM mode follow master's `<base>-<id>` 
spelling, the same one `DatanodeStorageMetrics` already used.
   



-- 
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]

Reply via email to