From 078e8cc239788bbec14a0e38492ed683341af7dc Mon Sep 17 00:00:00 2001 From: Govind Menon Date: Thu, 9 Aug 2018 13:51:10 -0500 Subject: [PATCH] STORM-3183: Fix for visualization on Storm API --- .../org/apache/storm/daemon/ui/UIHelpers.java | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/UIHelpers.java b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/UIHelpers.java index d6dc40987bc..a0805992d2e 100644 --- a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/UIHelpers.java +++ b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/UIHelpers.java @@ -1348,12 +1348,12 @@ public static Map> sanitizeTransferredStats(Map getStatMapFromExecutorSummary(ExecutorSummary executorSummary) { Map result = new HashMap(); - result.put("host", executorSummary.get_host()); - result.put("port", executorSummary.get_port()); - result.put("uptime_secs", executorSummary.get_uptime_secs()); - result.put("transferred", null); + result.put(":host", executorSummary.get_host()); + result.put(":port", executorSummary.get_port()); + result.put(":uptime_secs", executorSummary.get_uptime_secs()); + result.put(":transferred", null); if (executorSummary.is_set_stats()) { - result.put("transferred", sanitizeTransferredStats(executorSummary.get_stats().get_transferred())); + result.put(":transferred", sanitizeTransferredStats(executorSummary.get_stats().get_transferred())); } return result; } @@ -1366,12 +1366,11 @@ public static Map getStatMapFromExecutorSummary(ExecutorSummary * @return getInputMap */ public static Map getInputMap(Map.Entry entryInput) { - Map result = new HashMap(); - result.put("component", entryInput.getKey().get_componentId()); - result.put("stream", entryInput.getKey().get_streamId()); - result.put("sani-stream", sanitizeStreamName(entryInput.getKey().get_streamId())); - result.put("grouping", entryInput.getValue().getSetField().getFieldName()); + result.put(":component", entryInput.getKey().get_componentId()); + result.put(":stream", entryInput.getKey().get_streamId()); + result.put(":sani-stream", sanitizeStreamName(entryInput.getKey().get_streamId())); + result.put(":grouping", entryInput.getValue().getSetField().getFieldName()); return result; } @@ -1402,17 +1401,17 @@ public static Map getVisualizationData( String spoutComponentId = spoutSpecMapEntry.getKey(); if (spoutSummaries.containsKey(spoutComponentId)) { Map spoutData = new HashMap(); - spoutData.put("type", "spout"); - spoutData.put("capacity", 0); + spoutData.put(":type", "spout"); + spoutData.put(":capacity", 0); Map spoutStreamsStats = StatsUtil.spoutStreamsStats(spoutSummaries.get(spoutComponentId), true); - spoutData.put("latency", spoutStreamsStats.get("complete-latencies").get(window)); - spoutData.put("transferred", spoutStreamsStats.get("transferred").get(window)); - spoutData.put("stats", spoutSummaries.get( + spoutData.put(":latency", spoutStreamsStats.get("complete-latencies").get(window)); + spoutData.put(":transferred", spoutStreamsStats.get("transferred").get(window)); + spoutData.put(":stats", spoutSummaries.get( spoutComponentId).stream().map( UIHelpers::getStatMapFromExecutorSummary).collect(Collectors.toList())); - spoutData.put("link", UIHelpers.urlFormat("/component.html?id=%s&topology_id=%s", spoutComponentId, topoId)); + spoutData.put(":link", UIHelpers.urlFormat("/component.html?id=%s&topology_id=%s", spoutComponentId, topoId)); - result.put("inputs", + spoutData.put(":inputs", spoutSpecMapEntry.getValue().get_common().get_inputs().entrySet().stream().map( UIHelpers::getInputMap).collect(Collectors.toList()) ); @@ -1422,19 +1421,19 @@ public static Map getVisualizationData( for (Map.Entry boltEntry : boltSpecs.entrySet()) { String boltComponentId = boltEntry.getKey(); - if (boltSummaries.containsKey(boltComponentId) && (sys || Utils.isSystemId(boltComponentId))) { + if (boltSummaries.containsKey(boltComponentId) && (sys || !Utils.isSystemId(boltComponentId))) { Map boltMap = new HashMap(); - boltMap.put("type", "bolt"); - boltMap.put("capacity", StatsUtil.computeBoltCapacity(boltSummaries.get(boltComponentId))); + boltMap.put(":type", "bolt"); + boltMap.put(":capacity", StatsUtil.computeBoltCapacity(boltSummaries.get(boltComponentId))); Map boltStreamsStats = StatsUtil.boltStreamsStats(boltSummaries.get(boltComponentId), true); - boltMap.put("latency", boltStreamsStats.get("process-latencies").get(window)); - boltMap.put("transferred", boltStreamsStats.get("transferred").get(window)); - boltMap.put("stats", boltSummaries.get( + boltMap.put(":latency", boltStreamsStats.get("process-latencies").get(window)); + boltMap.put(":transferred", boltStreamsStats.get("transferred").get(window)); + boltMap.put(":stats", boltSummaries.get( boltComponentId).stream().map( UIHelpers::getStatMapFromExecutorSummary).collect(Collectors.toList())); - boltMap.put("link", UIHelpers.urlFormat("/component.html?id=%s&topology_id=%s", boltComponentId, topoId)); + boltMap.put(":link", UIHelpers.urlFormat("/component.html?id=%s&topology_id=%s", boltComponentId, topoId)); - result.put("inputs", + boltMap.put(":inputs", boltEntry.getValue().get_common().get_inputs().entrySet().stream().map( UIHelpers::getInputMap).collect(Collectors.toList()) );