avijayanhwx commented on a change in pull request #5: [AMBARI-24723] Support wild cards in AppId and InstanceId fields in AMS GET API. URL: https://github.com/apache/ambari-metrics/pull/5#discussion_r222836840
########## File path: ambari-metrics-timelineservice/src/main/java/org/apache/ambari/metrics/core/timeline/discovery/TimelineMetricMetadataManager.java ########## @@ -629,75 +629,97 @@ public TimelineMetric getMetricFromUuid(byte[] uuid) { String instanceId, List<String> transientMetricNames) { - Collection<String> sanitizedMetricNames = new HashSet<>(); List<byte[]> uuids = new ArrayList<>(); + boolean metricNameHasWildcard = false; for (String metricName : metricNames) { - if (metricName.contains("%")) { - String metricRegEx = getJavaRegexFromSqlRegex(metricName); - for (TimelineMetricMetadataKey key : METADATA_CACHE.keySet()) { - String metricNameFromMetadata = key.getMetricName(); - if (metricNameFromMetadata.matches(metricRegEx)) { - sanitizedMetricNames.add(metricNameFromMetadata); - } - } - } else { - sanitizedMetricNames.add(metricName); + if (hasWildCard(metricName)) { + metricNameHasWildcard = true; } } - if(sanitizedMetricNames.isEmpty()) { - return uuids; + boolean hostNameHasWildcard = false; + if (CollectionUtils.isNotEmpty(hostnames)) { + for (String hostname : hostnames) { + if (hasWildCard(hostname)) { + hostNameHasWildcard = true; Review comment: Resolved ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services