public String simplifyHostname(String hostname, int port) {
    for (String domainName : domainNamesToRemove) {
      if (domainName != null && !(domainName = domainName.trim()).isEmpty()) {
        if (domainName.charAt(0) != '.') {
          domainName = "." + domainName;
        }
        hostname = hostname.replace(domainName, "");
      }
    }
    return String.format("%s_%d", hostname, port);
  }
Simplify and shorten hostname. If the given hostname is fully qualified domain name, like "ambry1.prod.github.com",
and the {@link AccountStatsMySqlConfig#domainNamesToRemove} includes ".github.com", then the hostname will be
changed to "ambry1.prod_12345". "12345" is the given {@code port}.
@param hostname The hostname to simplify
@param port The port number.
@return The simplified hostname.
ambry-mysql/src/main/java/com/github/ambry/accountstats/HostnameHelper.java