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/06/11 18:09:46 UTC

[14/50] [abbrv] git commit: STORM-205. Add REST API to Storm UI. added complete-latencies to the topology-stats changed /api to /api/v1

STORM-205. Add REST API to Storm UI. added complete-latencies to the
topology-stats
changed /api to /api/v1


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

Branch: refs/heads/security
Commit: 900490b9caf8993ad0beee79fd4139b3bdee6359
Parents: 688444a
Author: Sriharsha Chintalapani <ma...@harsha.io>
Authored: Thu May 29 16:33:17 2014 -0700
Committer: Sriharsha Chintalapani <ma...@harsha.io>
Committed: Thu May 29 16:33:17 2014 -0700

----------------------------------------------------------------------
 storm-core/src/clj/backtype/storm/ui/core.clj | 32 +++++++++++-----------
 storm-core/src/ui/public/component.html       |  2 +-
 storm-core/src/ui/public/index.html           |  8 +++---
 storm-core/src/ui/public/js/script.js         |  2 +-
 storm-core/src/ui/public/topology.html        |  2 +-
 5 files changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/900490b9/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 d77ccb6..8bc1f9d 100644
--- a/storm-core/src/clj/backtype/storm/ui/core.clj
+++ b/storm-core/src/clj/backtype/storm/ui/core.clj
@@ -284,8 +284,8 @@
     (merge-with
      (fn [s1 s2]
        (merge-with + s1 s2))
-     (select-keys agg-bolt-stats [:emitted :transferred :acked :failed :complete-latencies])
-     (select-keys agg-spout-stats [:emitted :transferred :acked :failed :complete-latencies])
+     (select-keys agg-bolt-stats [:emitted :transferred :acked :failed])
+     (select-keys agg-spout-stats [:emitted :transferred :acked :failed])
      )))
 
 (defn stats-times [stats-map]
@@ -643,39 +643,39 @@
    })
 
 (defroutes main-routes
-  (GET "/api/cluster/configuration" []
+  (GET "/api/v1/cluster/configuration" []
        (cluster-configuration))
-  (GET "/api/cluster/summary" []
+  (GET "/api/v1/cluster/summary" []
        (json-response (cluster-summary)))
-  (GET "/api/supervisor/summary" []
+  (GET "/api/v1/supervisor/summary" []
        (json-response (supervisor-summary)))
-  (GET "/api/topology/summary" []
+  (GET "/api/v1/topology/summary" []
        (json-response (all-topologies-summary)))
-  (GET  "/api/topology/:id" [id & m]
+  (GET  "/api/v1/topology/:id" [id & m]
         (let [id (url-decode id)]
           (json-response (topology-page id (:window m) (check-include-sys? (:sys m))))))
-  (GET "/api/topology/:id/component/:component" [id component & m]
+  (GET "/api/v1/topology/:id/component/:component" [id component & m]
        (let [id (url-decode id)
              component (url-decode component)]
          (json-response (component-page id component (:window m) (check-include-sys? (:sys m))))))
-  (POST "/api/topology/:id/activate" [id]
+  (POST "/api/v1/topology/:id/activate" [id]
     (with-nimbus nimbus
       (let [id (url-decode id)
             tplg (.getTopologyInfo ^Nimbus$Client nimbus id)
             name (.get_name tplg)]
         (.activate nimbus name)
         (log-message "Activating topology '" name "'")))
-    (resp/redirect (str "/api/topology/" id)))
+    (resp/redirect (str "/api/v1/topology/" id)))
 
-  (POST "/api/topology/:id/deactivate" [id]
+  (POST "/api/v1/topology/:id/deactivate" [id]
     (with-nimbus nimbus
       (let [id (url-decode id)
             tplg (.getTopologyInfo ^Nimbus$Client nimbus id)
             name (.get_name tplg)]
         (.deactivate nimbus name)
         (log-message "Deactivating topology '" name "'")))
-    (resp/redirect (str "/api/topology/" id)))
-  (POST "/api/topology/:id/rebalance/:wait-time" [id wait-time]
+    (resp/redirect (str "/api/v1/topology/" id)))
+  (POST "/api/v1/topology/:id/rebalance/:wait-time" [id wait-time]
     (with-nimbus nimbus
       (let [id (url-decode id)
             tplg (.getTopologyInfo ^Nimbus$Client nimbus id)
@@ -684,8 +684,8 @@
         (.set_wait_secs options (Integer/parseInt wait-time))
         (.rebalance nimbus name options)
         (log-message "Rebalancing topology '" name "' with wait time: " wait-time " secs")))
-    (resp/redirect (str "/api/topology/" id)))
-  (POST "/api/topology/:id/kill/:wait-time" [id wait-time]
+    (resp/redirect (str "/api/v1/topology/" id)))
+  (POST "/api/v1/topology/:id/kill/:wait-time" [id wait-time]
     (with-nimbus nimbus
       (let [id (url-decode id)
             tplg (.getTopologyInfo ^Nimbus$Client nimbus id)
@@ -694,7 +694,7 @@
         (.set_wait_secs options (Integer/parseInt wait-time))
         (.killTopologyWithOpts nimbus name options)
         (log-message "Killing topology '" name "' with wait time: " wait-time " secs")))
-    (resp/redirect (str "/api/topology/" id)))
+    (resp/redirect (str "/api/v1/topology/" id)))
 
   (GET "/" [:as {cookies :cookies}]
        (resp/redirect "/index.html"))

http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/900490b9/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 1286e45..432b33d 100644
--- a/storm-core/src/ui/public/component.html
+++ b/storm-core/src/ui/public/component.html
@@ -34,7 +34,7 @@ $(document).ready(function() {
     var topologyId = $.url().param("topology_id");
     var window = $.url().param("window");
     var sys = $.cookies.get("sys") || "false";
-    var url = "/api/topology/"+topologyId+"/component/"+componentId+"?sys="+sys;
+    var url = "/api/v1/topology/"+topologyId+"/component/"+componentId+"?sys="+sys;
     if(window) url += "&window="+window;
     renderToggleSys($("#toggle-switch"));
     $.ajaxSetup({

http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/900490b9/storm-core/src/ui/public/index.html
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/index.html b/storm-core/src/ui/public/index.html
index dc20645..102b3c6 100644
--- a/storm-core/src/ui/public/index.html
+++ b/storm-core/src/ui/public/index.html
@@ -40,12 +40,12 @@ $(document).ready(function() {
     var supervisorSummary = $("#supervisor-summary");
     var config = $("#nimbus-configuration");
 
-    $.getJSON("/api/cluster/summary",function(response,status,jqXHR) {
+    $.getJSON("/api/v1/cluster/summary",function(response,status,jqXHR) {
         $.get("/templates/index-page-template.html", function(template) {
             clusterSummary.append(Mustache.render($(template).filter("#cluster-summary-template").html(),response));
         });
     });
-    $.getJSON("/api/topology/summary",function(response,status,jqXHR) {
+    $.getJSON("/api/v1/topology/summary",function(response,status,jqXHR) {
       $.get("/templates/index-page-template.html", function(template) {
           topologySummary.append(Mustache.render($(template).filter("#topology-summary-template").html(),response));
           if(response["topologies"].length > 0) {
@@ -53,7 +53,7 @@ $(document).ready(function() {
               }
       });
     });
-    $.getJSON("/api/supervisor/summary",function(response,status,jqXHR) {
+    $.getJSON("/api/v1/supervisor/summary",function(response,status,jqXHR) {
       $.get("/templates/index-page-template.html", function(template) {
           supervisorSummary.append(Mustache.render($(template).filter("#supervisor-summary-template").html(),response));
           if(response["supervisors"].length > 0) {
@@ -61,7 +61,7 @@ $(document).ready(function() {
           }
       });
     });
-    $.getJSON("/api/cluster/configuration",function(response,status,jqXHR) {
+    $.getJSON("/api/v1/cluster/configuration",function(response,status,jqXHR) {
       var formattedResponse = formatConfigData(response);
       $.get("/templates/index-page-template.html", function(template) {
           config.append(Mustache.render($(template).filter("#configuration-template").html(),formattedResponse));

http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/900490b9/storm-core/src/ui/public/js/script.js
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/js/script.js b/storm-core/src/ui/public/js/script.js
index ab4a825..8f7608e 100644
--- a/storm-core/src/ui/public/js/script.js
+++ b/storm-core/src/ui/public/js/script.js
@@ -71,7 +71,7 @@ function ensureInt(n) {
 function confirmAction(id, name, action, wait, defaultWait) {
     var opts = {
         type:'POST',
-        url:'/api/topology/' + id + '/' + action
+        url:'/api/v1/topology/' + id + '/' + action
     };
     if (wait) {
         var waitSecs = prompt('Do you really want to ' + action + ' topology "' + name + '"? ' +

http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/900490b9/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 c80bbe5..55e8ea0 100644
--- a/storm-core/src/ui/public/topology.html
+++ b/storm-core/src/ui/public/topology.html
@@ -37,7 +37,7 @@ $(document).ready(function() {
     var topologyId = $.url().param("id");
     var window = $.url().param("window");
     var sys = $.cookies.get("sys") || "false";
-    var url = "/api/topology/"+topologyId+"?sys="+sys;
+    var url = "/api/v1/topology/"+topologyId+"?sys="+sys;
     if(window) url += "&window="+window;
     renderToggleSys($("#toggle-switch"));
     $.ajaxSetup({