Ethanlm commented on a change in pull request #3312:
URL: https://github.com/apache/storm/pull/3312#discussion_r468301085



##########
File path: storm-webapp/src/main/java/org/apache/storm/daemon/ui/UIHelpers.java
##########
@@ -1488,16 +1495,21 @@ private static Double nullToZero(Double value) {
      * @return getTopologySpoutAggStatsMap
      */
     private static Map<String, Object> 
getTopologySpoutAggStatsMap(ComponentAggregateStats componentAggregateStats,
-                                                                   String 
spoutId) {
+                                                                   String 
spoutId, Map<String, Object> config, String topologyId) {
         Map<String, Object> result = new HashMap();
         CommonAggregateStats commonStats = 
componentAggregateStats.get_common_stats();
         result.putAll(getCommonAggStatsMap(commonStats));
         result.put("spoutId", spoutId);
         result.put("encodedSpoutId", Utils.urlEncodeUtf8(spoutId));
         SpoutAggregateStats spoutAggregateStats = 
componentAggregateStats.get_specific_stats().get_spout();
-        result.put("completeLatency", 
spoutAggregateStats.get_complete_latency_ms());
+        result.put("completeLatency", 
StatsUtil.floatStr(spoutAggregateStats.get_complete_latency_ms()));
         ErrorInfo lastError = componentAggregateStats.get_last_error();
-        result.put("lastError", Objects.isNull(lastError) ?  "" : 
getTruncatedErrorString(lastError.get_error()));
+        if (!Objects.isNull(lastError)) {
+            result.putAll(getComponentErrorInfo(lastError, config, topologyId, 
true));
+        } else {
+            // Maintain backwards compatibility in the API response by setting 
empty string value

Review comment:
       You are right. Sorry I overlooked. I think we can default those keys to 
empty like you said

##########
File path: storm-core/test/jvm/org/apache/storm/stats/TestStatsUtil.java
##########
@@ -92,6 +113,33 @@ public void makeTopoInfo() {
         worker2Resources.put(new WorkerSlot("node3", 3), ws3);
     }
 
+    private Map<String, Object> createBeatBoltStats() {
+        return createBeatStats("bolt");
+    }
+
+    private Map<String, Object> createBeatSpoutStats() {
+        return createBeatStats("spout");
+    }
+
+    private Map<String, Object> createBeatStats(final String type) {
+        Map<String, Object> stats = new HashMap<>();
+        stats.put("type", type);
+
+        stats.put("acked", new HashMap<>());

Review comment:
       Bolt and spout have different stats
   
https://github.com/apache/storm/blob/master/storm-server/src/main/java/org/apache/storm/stats/StatsUtil.java#L2049-L2085
   
   It would be nice to reflect that here even though the information is not 
really used  .
   




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to