You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2014/07/31 02:04:10 UTC

[06/20] git commit: Use javascript to color-code recent errors

Use javascript to color-code recent errors


Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/7bb8ec6d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/7bb8ec6d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/7bb8ec6d

Branch: refs/heads/security
Commit: 7bb8ec6d8068fe2eeec65085bfa0140aca0fb0a9
Parents: 8325186
Author: Kishor Patil <kp...@yahoo-inc.com>
Authored: Thu Jun 26 00:13:03 2014 +0000
Committer: Kishor Patil <kp...@yahoo-inc.com>
Committed: Thu Jun 26 00:13:03 2014 +0000

----------------------------------------------------------------------
 storm-core/src/clj/backtype/storm/ui/core.clj         | 14 +++++++-------
 storm-core/src/ui/public/component.html               | 10 ++++++++++
 .../ui/public/templates/component-page-template.html  |  4 +---
 .../ui/public/templates/topology-page-template.html   |  8 ++------
 storm-core/src/ui/public/topology.html                | 10 ++++++++++
 5 files changed, 30 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/7bb8ec6d/storm-core/src/clj/backtype/storm/ui/core.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/ui/core.clj b/storm-core/src/clj/backtype/storm/ui/core.clj
index bc3f506..a7492f9 100644
--- a/storm-core/src/clj/backtype/storm/ui/core.clj
+++ b/storm-core/src/clj/backtype/storm/ui/core.clj
@@ -319,11 +319,11 @@
        (map nil-to-zero)
        (apply max)))
 
-(defn is-error-recent?
+(defn get-error-time
   [error]
-  (if error (< (time-delta (.get_error_time_secs ^ErrorInfo error))
-                    (* 60 30))
-    false))
+  (if error 
+     (time-delta (.get_error_time_secs ^ErrorInfo error))
+     ""))
 
 (defn get-error-data
   [error]
@@ -596,7 +596,7 @@
      "errorHost" error-host
      "errorPort" error-port
      "errorWorkerLogLink" (worker-log-link error-host error-port top-id)
-     (if (is-error-recent? last-error) "isRecent" "isNotRecent") true
+     "errorLapsedSecs" (get-error-time last-error)
      "lastError" (get-error-data last-error)}))
 
 (defn bolt-comp [top-id summ-map errors window include-sys?]
@@ -622,7 +622,7 @@
      "errorHost" error-host
      "errorPort" error-port
      "errorWorkerLogLink" (worker-log-link error-host error-port top-id)
-     (if (is-error-recent? last-error) "isRecent" "isNotRecent") true
+     "errorLapsedSecs" (get-error-time last-error)
      "lastError" (get-error-data last-error)}))
 
 (defn topology-summary [^TopologyInfo summ]
@@ -733,7 +733,7 @@
         "errorHost" (.get_host e)
         "errorPort"  (.get_port e)
         "errorWorkerLogLink"  (worker-log-link (.get_host e) (.get_port e) topology-id)
-        (if (is-error-recent? e) "isRecent" "isNotRecent") true
+        "errorLapsedSecs" (get-error-time e)
         "error" (.get_error e)})}))
 
 (defn spout-stats

http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/7bb8ec6d/storm-core/src/ui/public/component.html
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/component.html b/storm-core/src/ui/public/component.html
index 0951aed..d0e0869 100644
--- a/storm-core/src/ui/public/component.html
+++ b/storm-core/src/ui/public/component.html
@@ -103,6 +103,16 @@ $(document).ready(function() {
             if(response["componentErrors"].length > 0) {
                 $("#component-errors-table").tablesorter({ sortList: [[0,0]], headers: {1: { sorter: "stormtimestr"}}});
             }
+
+            var errorCells = document.getElementsByClassName("errorSpan");
+            for (i =0; i < errorCells.length; i++)
+            {
+              var timeLapsedInSecs = errorCells[i].id;
+              if (parseInt(timeLapsedInSecs) < 1800) {
+                errorCells[i].style.color = "#9d261d";
+                errorCells[i].style.borderBottomColor = "#9d261d";
+              }
+            }
         });
     });
 });

http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/7bb8ec6d/storm-core/src/ui/public/templates/component-page-template.html
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/templates/component-page-template.html b/storm-core/src/ui/public/templates/component-page-template.html
index 4aac1e8..561dc4a 100644
--- a/storm-core/src/ui/public/templates/component-page-template.html
+++ b/storm-core/src/ui/public/templates/component-page-template.html
@@ -164,9 +164,7 @@
 <td>{{errorHost}}</td>
 <td><a href="{{errorWorkerLogLink}}">{{errorPort}}</a></td>
 <td>
-<span{{#isRecent}} class="red"{{/isRecent}}>
-{{error}}
-</span>
+<span id="{{errorLapsedSecs}}" class="errorSpan">{{error}}</span>
 </td>
 </tr>
 {{/componentErrors}}

http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/7bb8ec6d/storm-core/src/ui/public/templates/topology-page-template.html
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/templates/topology-page-template.html b/storm-core/src/ui/public/templates/topology-page-template.html
index 188a6f1..c249053 100644
--- a/storm-core/src/ui/public/templates/topology-page-template.html
+++ b/storm-core/src/ui/public/templates/topology-page-template.html
@@ -125,9 +125,7 @@
         <td>{{errorHost}}</td>
         <td><a href="{{errorWorkerLogLink}}">{{errorPort}}</a></td>
         <td>
-        <span{{#isRecent}} class="red"{{/isRecent}}>
-        {{lastError}}
-        </span>
+          <span id="{{errorLapsedSecs}}" class="errorSpan">{{lastError}}</span>
         </td>
         {{/spouts}}
     </tbody>
@@ -155,9 +153,7 @@
         <td>{{errorHost}}</td>
         <td><a href="{{errorWorkerLogLink}}">{{errorPort}}</a></td>
         <td>
-        <span{{#isRecent}} class="red"{{/isRecent}}>
-        {{lastError}}
-        </span>
+          <span id="{{errorLapsedSecs}}" class="errorSpan">{{lastError}}</span>
         </td>
         {{/bolts}}
     </tbody>

http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/7bb8ec6d/storm-core/src/ui/public/topology.html
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/topology.html b/storm-core/src/ui/public/topology.html
index 74afb08..b7d7855 100644
--- a/storm-core/src/ui/public/topology.html
+++ b/storm-core/src/ui/public/topology.html
@@ -104,6 +104,16 @@ $(document).ready(function() {
 
             config.append(Mustache.render($(template).filter("#topology-configuration-template").html(),formattedConfig));
             $("#topology-configuration-table").tablesorter({ sortList: [[0,0]], headers: {}});
+
+            var errorCells = document.getElementsByClassName("errorSpan");
+            for (i =0; i < errorCells.length; i++)
+            {
+              var timeLapsedInSecs = errorCells[i].id;
+              if (parseInt(timeLapsedInSecs) < 1800) {
+                errorCells[i].style.color = "#9d261d";
+                errorCells[i].style.borderBottomColor = "#9d261d";
+              }
+            }
         });
     });
  });