/** * * Returns the cluster name on which the application is running. Uses default hadoop {@link Configuration} to get the * url of the resourceManager or jobtracker. The URL is then translated into a human readable cluster name using * {@link #getClusterName(String)} * * @see #getClusterName(Configuration) * */ public String getClusterName() { return getClusterName(HADOOP_CONFIGURATION); }
/** * @deprecated use {@link ClustersNames#getInstance()#getClusterName()} */ @Deprecated public static String getClusterIdentifierTag() { return ClustersNames.getInstance().getClusterName(); } }
private static String getFSIdentifier(URI uri) { return ClustersNames.getInstance().getClusterName(uri.toString()); }
/** * Gets all useful Hadoop cluster metrics. * * @param conf a Hadoop {@link Configuration} to collect the metadata from * * @return a {@link Map} of key, value pairs containing the cluster metadata */ public static Map<String, String> getClusterNameTags(Configuration conf) { ImmutableMap.Builder<String, String> tagMap = ImmutableMap.builder(); String clusterIdentifierTag = ClustersNames.getInstance().getClusterName(conf); if (!Strings.isNullOrEmpty(clusterIdentifierTag)) { tagMap.put(CLUSTER_IDENTIFIER_TAG_NAME, clusterIdentifierTag); } return tagMap.build(); } }
private static String getFSIdentifier(URI uri) { if (new LocalFileSystem().getScheme().equals(uri.getScheme())) { return "localhost"; } else { return ClustersNames.getInstance().getClusterName(uri.toString()); } }
clusterIdentifier = getClusterName(clusterIdentifier);