Source:
private boolean reportMetric(final JsonNode metric, @Nullable final AtomicInteger pointCounter) { if (metric == null) { pointHandler.reject((ReportPoint) null, "Skipping - series object null."); return false; } try { if (metric.get("metric") == null ) { pointHandler.reject((ReportPoint) null, "Skipping - 'metric' field missing."); return false; } String metricName = INVALID_METRIC_CHARACTERS.matcher(metric.get("metric").textValue()). replaceAll("_"); String hostName = metric.get("host") == null ? "unknown" : metric.get("host").textValue(). toLowerCase(); JsonNode tagsNode = metric.get("tags"); Map<String, String> systemTags; Map<String, String> tags = new HashMap<>(); if ((systemTags = tagsCache.getIfPresent(hostName)) != null) { tags.putAll(systemTags); } extractTags(tagsNode, tags); JsonNode deviceNode = metric.get("device"); if (deviceNode != null) { tags.put("device", deviceNode.textValue()); } int interval = 1; JsonNode type = metric.get("type"); if (type != null) { if (type.textValue().equals("rate")) { interval = metric.get("interval") == null ? 1 : metric.get("interval").intValue(); } } JsonNode pointsNode = metric.get("points"); if (pointsNode == null) { pointHandler.reject((ReportPoint) null, "Skipping - 'points' field missing."); return false; } for (JsonNode node : pointsNode) { if (node.size() == 2) { reportValue(metricName, hostName, tags, node.get(1), node.get(0).longValue() * 1000, pointCounter, interval); } else { pointHandler.reject((ReportPoint) null, "WF-300: Inconsistent point value size (expected: 2)"); } } return true; } catch (final Exception e) { logger.log(Level.WARNING, "WF-300: Failed to add metric", e); return false; } }

Target:
private boolean reportMetric(final JsonNode metric, @Nullable final AtomicInteger pointCounter) { if (metric == null) { pointHandler.reject((ReportPoint) null, "Skipping - series object null."); return false; } try { if (metric.get("metric") == null ) { pointHandler.reject((ReportPoint) null, "Skipping - 'metric' field missing."); return false; } String metricName = INVALID_METRIC_CHARACTERS.matcher(metric.get("metric").textValue()). replaceAll("_"); String hostName = metric.get("host") == null ? "unknown" : metric.get("host").textValue(). toLowerCase(); JsonNode tagsNode = metric.get("tags"); Map<String, String> systemTags; Map<String, String> tags = new HashMap<>(); if ((systemTags = tagsCache.getIfPresent(hostName)) != null) { tags.putAll(systemTags); } extractTags(tagsNode, tags); JsonNode deviceNode = metric.get("device"); if (deviceNode != null) { tags.put("device", deviceNode.textValue()); } int interval = 1; JsonNode type = metric.get("type"); if (type != null) { if (type.textValue().equals("rate")) { JsonNode jsonInterval = metric.get("interval"); if (jsonInterval != null && jsonInterval.isNumber()) { interval = jsonInterval.intValue(); } } } JsonNode pointsNode = metric.get("points"); if (pointsNode == null) { pointHandler.reject((ReportPoint) null, "Skipping - 'points' field missing."); return false; } for (JsonNode node : pointsNode) { if (node.size() == 2) { reportValue(metricName, hostName, tags, node.get(1), node.get(0).longValue() * 1000, pointCounter, interval); } else { pointHandler.reject((ReportPoint) null, "WF-300: Inconsistent point value size (expected: 2)"); } } return true; } catch (final Exception e) { logger.log(Level.WARNING, "WF-300: Failed to add metric", e); return false; } }