dandsager1 commented on a change in pull request #3008: STORM-3392 Topology 
page should show components even if workers haven…
URL: https://github.com/apache/storm/pull/3008#discussion_r285168427
 
 

 ##########
 File path: 
storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
 ##########
 @@ -4129,6 +4136,83 @@ public TopologyPageInfo getTopologyPageInfo(String 
topoId, String window, boolea
         }
     }
 
+    /**
+     * Add placeholder AggStats allowing topology page to show components 
before AggStats are populated.
+     *
+     * @param topoPageInfo topology page info holding spout AggStats
+     * @param topology     storm topology used to get spout names
+     */
+    private void maybeAddPlaceholderSpoutAggStats(TopologyPageInfo 
topoPageInfo, StormTopology topology) {
+        if (topoPageInfo.get_id_to_spout_agg_stats().isEmpty()) {
+            Map<String, SpoutSpec> spouts = topology.get_spouts();
+            for (Entry<String, SpoutSpec> entry : spouts.entrySet()) {
+                // component
+                ComponentAggregateStats placeholderComponentStats = new 
ComponentAggregateStats();
+                placeholderComponentStats.set_type(ComponentType.SPOUT);
+
+                // common aggregate
+                CommonAggregateStats commonStats = new CommonAggregateStats();
+                commonStats.set_num_executors(0);
+                commonStats.set_num_tasks(0);
+                commonStats.set_emitted(0);
+                commonStats.set_transferred(0);
+                commonStats.set_acked(0);
+                placeholderComponentStats.set_common_stats(commonStats);
+
+                // spout aggregate
+                SpoutAggregateStats spoutAggStats = new SpoutAggregateStats();
+                spoutAggStats.set_complete_latency_ms(0);
+                SpecificAggregateStats specificStats = new 
SpecificAggregateStats();
+                specificStats.set_spout(spoutAggStats);
+                placeholderComponentStats.set_specific_stats(specificStats);
+
+                topoPageInfo.get_id_to_spout_agg_stats().put(entry.getKey(), 
placeholderComponentStats);
+            }
+        }
+    }
+
+    /**
+     * Add placeholder AggStats allowing topology page to show components 
before AggStats are populated.
+     *
+     * @param topoPageInfo  topology page info holding bolt AggStats
+     * @param topology      storm topology used to get bolt names
+     */
+    private void maybeAddPlaceholderBoltAggStats(TopologyPageInfo 
topoPageInfo, StormTopology topology) {
+        if (topoPageInfo.get_id_to_bolt_agg_stats().isEmpty()) {
+            Map<String, Bolt> bolts = topology.get_bolts();
+            for (Entry<String, Bolt> entry : bolts.entrySet()) {
+                if (Utils.isSystemId(entry.getKey())) {
 
 Review comment:
   The idea was to show active topology components. It is easy to filter based 
on the includeSys param passed into getTopologyPageInfo

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to