Source:
private void validateThresholdAndWrite(Locator locator, List<String> currentEnumValues) { log.debug(String.format("EnumValidator validating locator %s", locator.toString())); if ((currentEnumValues != null) && (currentEnumValues.size() > ENUM_UNIQUE_VALUES_THRESHOLD)) { try { IOContainer.fromConfig().getExcessEnumIO().insertExcessEnumMetric(locator); } catch (Exception e) { log.error(String.format("Exception writing bad metric %s: %s", locator.toString(), e.getMessage()), e); } } else { List<SearchResult> esSearchResult = null; try { esSearchResult = getDiscoveryIO().search(locator.getTenantId(), locator.getMetricName()); } catch (Exception e) { log.error(String.format("Exception retrieving enum values from elasticsearch for %s: %s", locator.toString(), e.getMessage()), e); } List<String> elasticsearchEnumValues = null; if ((esSearchResult != null) && (esSearchResult.size() > 0)) { elasticsearchEnumValues = esSearchResult.get(0).getEnumValues(); } if (currentEnumValues != null) Collections.sort(currentEnumValues); if (elasticsearchEnumValues != null) Collections.sort(elasticsearchEnumValues); if ((currentEnumValues != null) && (currentEnumValues.size() > 0) && (!currentEnumValues.equals(elasticsearchEnumValues))) { BluefloodEnumRollup rollupWithEnumValues = createRollupWithEnumValues(currentEnumValues); IMetric enumMetric = new PreaggregatedMetric(0, locator, null, rollupWithEnumValues); try { getDiscoveryIO().insertDiscovery(enumMetric); } catch (Exception e) { log.error(String.format("Exception writing enums index to elasticsearch for %s: %s", locator.toString(), e.getMessage()), e); } } } }

Target:
private void validateThresholdAndWrite(Locator locator, List<String> currentEnumValues) { log.debug(String.format("EnumValidator validating locator %s", locator.toString())); if ((currentEnumValues != null) && (currentEnumValues.size() > ENUM_UNIQUE_VALUES_THRESHOLD)) { try { IOContainer.fromConfig().getExcessEnumIO().insertExcessEnumMetric(locator); } catch (IOException e) { log.error(String.format("Exception writing bad metric %s", locator.toString()), e); } } else { List<SearchResult> esSearchResult = null; try { esSearchResult = getDiscoveryIO().search(locator.getTenantId(), locator.getMetricName()); } catch (Exception e) { log.error(String.format("Exception retrieving enum values from elasticsearch for %s: %s", locator.toString(), e.getMessage()), e); } List<String> elasticsearchEnumValues = null; if ((esSearchResult != null) && (esSearchResult.size() > 0)) { elasticsearchEnumValues = esSearchResult.get(0).getEnumValues(); } if (currentEnumValues != null) Collections.sort(currentEnumValues); if (elasticsearchEnumValues != null) Collections.sort(elasticsearchEnumValues); if ((currentEnumValues != null) && (currentEnumValues.size() > 0) && (!currentEnumValues.equals(elasticsearchEnumValues))) { BluefloodEnumRollup rollupWithEnumValues = createRollupWithEnumValues(currentEnumValues); IMetric enumMetric = new PreaggregatedMetric(0, locator, null, rollupWithEnumValues); try { getDiscoveryIO().insertDiscovery(enumMetric); } catch (Exception e) { log.error(String.format("Exception writing enums index to elasticsearch for %s: %s", locator.toString(), e.getMessage()), e); } } } }