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



##########
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:
       Since the previous behavior always defaulted `lastError` to empty 
string, and the API docs show it defaulting to empty string, I've left this 
here for backwards compatibility. 
   
   If you think it'd be better to just exclude it (as we do with the other keys 
like `errorPort`, `errorHost`, `errorTime` etc.. let me know and I can remove 
the else block.




----------------------------------------------------------------
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