@Override public ObjectName createObjectName(String domain, Monitor<?> monitor) { ObjectNameBuilder objBuilder = ObjectNameBuilder.forDomain(domain); Map<String, String> tags = new TreeMap<>( monitor.getConfig().getTags().asMap()); // For the known ordered keys, try to add them if they're present in the monitor's tags for (String knownKey : keyOrder) { // Special case for name as it isn't a tag if ("name".equals(knownKey)) { addName(objBuilder, monitor); } else { String value = tags.remove(knownKey); if (value != null) { objBuilder.addProperty(knownKey, value); } } } // If appending, then add the name (if not already added) and remaining tags if (appendRemaining) { if (!orderIncludesName) { addName(objBuilder, monitor); } for (Map.Entry<String, String> additionalTag : tags.entrySet()) { objBuilder.addProperty(additionalTag.getKey(), additionalTag.getValue()); } } return objBuilder.build(); }
@Override public ObjectName createObjectName(String domain, Monitor<?> monitor) { ObjectNameBuilder objBuilder = ObjectNameBuilder.forDomain(domain); Map<String, String> tags = new TreeMap<>( monitor.getConfig().getTags().asMap()); // For the known ordered keys, try to add them if they're present in the monitor's tags for (String knownKey : keyOrder) { // Special case for name as it isn't a tag if ("name".equals(knownKey)) { addName(objBuilder, monitor); } else { String value = tags.remove(knownKey); if (value != null) { objBuilder.addProperty(knownKey, value); } } } // If appending, then add the name (if not already added) and remaining tags if (appendRemaining) { if (!orderIncludesName) { addName(objBuilder, monitor); } for (Map.Entry<String, String> additionalTag : tags.entrySet()) { objBuilder.addProperty(additionalTag.getKey(), additionalTag.getValue()); } } return objBuilder.build(); }