klsince commented on code in PR #9171:
URL: https://github.com/apache/pinot/pull/9171#discussion_r947277104


##########
pinot-common/src/main/java/org/apache/pinot/common/utils/config/InstanceUtils.java:
##########
@@ -59,6 +60,32 @@ public static String getHelixInstanceId(Instance instance) {
     return prefix + instance.getHost() + "_" + instance.getPort();
   }
 
+  public static String getInstanceAdminEndpoint(InstanceConfig instanceConfig, 
int defaultPort) {
+    // Backward-compatible with legacy hostname of format 'Server_<hostname>'
+    String hostname = instanceConfig.getHostName();
+    if (hostname.startsWith(Helix.PREFIX_OF_SERVER_INSTANCE)) {
+      hostname = hostname.substring(Helix.SERVER_INSTANCE_PREFIX_LENGTH);
+    }
+    return getInstanceAdminEndpoint(instanceConfig, 
CommonConstants.HTTP_PROTOCOL, hostname, defaultPort);
+  }
+
+  public static String getInstanceAdminEndpoint(InstanceConfig instanceConfig, 
String defaultProtocol, String hostname,

Review Comment:
   as in ServerInstance.java, `_hostname` is precalculatd, and it can come from 
different fields in InstanceConfig. The logic seems a bit specific to that 
class. So I kept this method to take in that precalculated hostname directly.



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to