incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [06/11] git commit: Replacing old jsp status pages with thrift/ajax based pages. Also adding a new page on the status pages for trace viewing.
Date Mon, 02 Dec 2013 13:41:51 GMT
Replacing old jsp status pages with thrift/ajax based pages.  Also adding a new page on the status pages for trace viewing.


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

Branch: refs/heads/master
Commit: cc606b47bdff59c445b0fad5bb95e23f2f40199f
Parents: 6dd5db5
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Mon Dec 2 08:28:24 2013 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Mon Dec 2 08:41:32 2013 -0500

----------------------------------------------------------------------
 .../apache/blur/server/FilteredBlurServer.java  |   16 +
 .../java/org/apache/blur/thrift/TableAdmin.java |   43 +
 .../blur/thrift/ThriftBlurControllerServer.java |    8 +-
 .../blur/thrift/ThriftBlurShardServer.java      |    8 +-
 .../org/apache/blur/thrift/ThriftServer.java    |   12 +-
 .../java/org/apache/blur/utils/BlurUtil.java    |    5 -
 .../apache/blur/manager/IndexManagerTest.java   |   11 +-
 blur-gui/src/main/webapp/index.html             |   79 +-
 blur-gui/src/main/webapp/index2.html            |   98 -
 blur-gui/src/main/webapp/js/Blur.js             |  660 ++++
 blur-gui/src/main/webapp/metrics.html           |   12 +-
 blur-gui/src/main/webapp/traces.html            |  264 ++
 .../org/apache/blur/thrift/generated/Blur.java  | 3652 ++++++++++++++++++
 .../blur/thrift/util/SimpleQueryExample.java    |    3 +-
 .../org/apache/blur/trace/BaseTraceStorage.java |   51 +
 .../org/apache/blur/trace/LogTraceReporter.java |   44 -
 .../org/apache/blur/trace/LogTraceStorage.java  |   44 +
 .../main/java/org/apache/blur/trace/Trace.java  |   16 +-
 .../org/apache/blur/trace/TraceCollector.java   |    7 +-
 .../org/apache/blur/trace/TraceReporter.java    |   33 -
 .../org/apache/blur/trace/TraceStorage.java     |   43 +
 .../java/org/apache/blur/trace/TracerImpl.java  |    4 +-
 .../blur/trace/ZooKeeperTraceReporter.java      |  139 -
 .../blur/trace/ZooKeeperTraceStorage.java       |  234 ++
 .../java/org/apache/blur/zookeeper/ZkUtils.java |    8 +
 .../java/org/apache/blur/trace/TraceTest.java   |   12 +-
 .../blur/trace/ZooKeeperTraceStorageTest.java   |  122 +
 .../src/main/scripts/interface/Blur.thrift      |   34 +
 .../main/scripts/interface/gen-html/Blur.html   |   35 +
 .../main/scripts/interface/gen-html/index.html  |    4 +
 .../org/apache/blur/thrift/generated/Blur.java  | 3652 ++++++++++++++++++
 .../src/main/scripts/interface/gen-js/Blur.js   |  660 ++++
 .../scripts/interface/gen-perl/Blur/Blur.pm     |  905 +++++
 .../src/main/scripts/interface/gen-rb/blur.rb   |  246 ++
 docs/Blur.html                                  |   35 +
 35 files changed, 10832 insertions(+), 367 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/cc606b47/blur-core/src/main/java/org/apache/blur/server/FilteredBlurServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/server/FilteredBlurServer.java b/blur-core/src/main/java/org/apache/blur/server/FilteredBlurServer.java
index 6056bb3..fcfe129 100644
--- a/blur-core/src/main/java/org/apache/blur/server/FilteredBlurServer.java
+++ b/blur-core/src/main/java/org/apache/blur/server/FilteredBlurServer.java
@@ -202,4 +202,20 @@ public class FilteredBlurServer implements Iface {
     return _iface.metrics(metrics);
   }
 
+  public List<String> traceList() throws BlurException, TException {
+    return _iface.traceList();
+  }
+
+  public List<String> traceRequestList(String traceId) throws BlurException, TException {
+    return _iface.traceRequestList(traceId);
+  }
+
+  public String traceRequestFetch(String traceId, String requestId) throws BlurException, TException {
+    return _iface.traceRequestFetch(traceId, requestId);
+  }
+
+  public void traceRemove(String traceId) throws BlurException, TException {
+    _iface.traceRemove(traceId);
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/cc606b47/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java b/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java
index 9bd68a3..d487916 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java
@@ -37,6 +37,8 @@ import org.apache.blur.thrift.generated.Metric;
 import org.apache.blur.thrift.generated.Selector;
 import org.apache.blur.thrift.generated.ShardState;
 import org.apache.blur.thrift.generated.TableDescriptor;
+import org.apache.blur.trace.Trace;
+import org.apache.blur.trace.TraceStorage;
 import org.apache.blur.utils.BlurUtil;
 import org.apache.blur.utils.MemoryReporter;
 import org.apache.zookeeper.ZooKeeper;
@@ -434,6 +436,47 @@ public abstract class TableAdmin implements Iface {
     }
   }
 
+  @Override
+  public List<String> traceList() throws BlurException, TException {
+    TraceStorage storage = Trace.getStorage();
+    try {
+      return storage.getTraceIds();
+    } catch (Exception e) {
+      throw new BException("Unknown error while trying to get traceList", e);
+    }
+  }
+
+  @Override
+  public List<String> traceRequestList(String traceId) throws BlurException, TException {
+    TraceStorage storage = Trace.getStorage();
+    try {
+      return storage.getRequestIds(traceId);
+    } catch (Exception e) {
+      throw new BException("Unknown error while trying to get traceRequestList for traceId [{0}]", e, traceId);
+    }
+  }
+
+  @Override
+  public String traceRequestFetch(String traceId, String requestId) throws BlurException, TException {
+    TraceStorage storage = Trace.getStorage();
+    try {
+      return storage.getRequestContentsJson(traceId, requestId);
+    } catch (Exception e) {
+      throw new BException("Unknown error while trying to get traceRequestList for traceId [{0}] requestId [{1}]", e,
+          traceId, requestId);
+    }
+  }
+
+  @Override
+  public void traceRemove(String traceId) throws BlurException, TException {
+    TraceStorage storage = Trace.getStorage();
+    try {
+      storage.removeTrace(traceId);
+    } catch (Exception e) {
+      throw new BException("Unknown error while trying to get remove trace [{0}]", e, traceId);
+    }
+  }
+
   private boolean inSafeMode(boolean useCache, String table) throws BlurException {
     String cluster = _clusterStatus.getCluster(useCache, table);
     if (cluster == null) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/cc606b47/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
index cb72594..d6a487d 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
@@ -59,7 +59,7 @@ import org.apache.blur.server.ControllerServerEventHandler;
 import org.apache.blur.thirdparty.thrift_0_9_0.transport.TNonblockingServerSocket;
 import org.apache.blur.thrift.generated.Blur.Iface;
 import org.apache.blur.trace.Trace;
-import org.apache.blur.trace.TraceReporter;
+import org.apache.blur.trace.TraceStorage;
 import org.apache.blur.utils.BlurUtil;
 import org.apache.blur.utils.MemoryReporter;
 import org.apache.blur.zookeeper.ZkUtils;
@@ -138,8 +138,8 @@ public class ThriftBlurControllerServer extends ThriftServer {
 
     controllerServer.init();
 
-    final TraceReporter traceReporter = setupTraceReporter(configuration);
-    Trace.setReporter(traceReporter);
+    final TraceStorage traceStorage = setupTraceStorage(configuration);
+    Trace.setStorage(traceStorage);
     Trace.setNodeName(nodeName);
 
     Iface iface = BlurUtil.wrapFilteredBlurServer(configuration, controllerServer, false);
@@ -178,7 +178,7 @@ public class ThriftBlurControllerServer extends ThriftServer {
       @Override
       public void shutdown() {
         ThreadWatcher threadWatcher = ThreadWatcher.instance();
-        quietClose(traceReporter, server, controllerServer, clusterStatus, zooKeeper, threadWatcher, httpServer);
+        quietClose(traceStorage, server, controllerServer, clusterStatus, zooKeeper, threadWatcher, httpServer);
       }
     };
     server.setShutdown(shutdown);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/cc606b47/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
index ed9ce21..d247d3a 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
@@ -87,7 +87,7 @@ import org.apache.blur.thirdparty.thrift_0_9_0.transport.TNonblockingServerSocke
 import org.apache.blur.thrift.generated.Blur;
 import org.apache.blur.thrift.generated.Blur.Iface;
 import org.apache.blur.trace.Trace;
-import org.apache.blur.trace.TraceReporter;
+import org.apache.blur.trace.TraceStorage;
 import org.apache.blur.utils.BlurUtil;
 import org.apache.blur.utils.GCWatcher;
 import org.apache.blur.utils.MemoryReporter;
@@ -232,8 +232,8 @@ public class ThriftBlurShardServer extends ThriftServer {
     shardServer.setConfiguration(configuration);
     shardServer.init();
     
-    final TraceReporter traceReporter = setupTraceReporter(configuration);
-    Trace.setReporter(traceReporter);
+    final TraceStorage traceStorage = setupTraceStorage(configuration);
+    Trace.setStorage(traceStorage);
     Trace.setNodeName(nodeName);
 
     Iface iface = BlurUtil.wrapFilteredBlurServer(configuration, shardServer, true);
@@ -268,7 +268,7 @@ public class ThriftBlurShardServer extends ThriftServer {
       @Override
       public void shutdown() {
         ThreadWatcher threadWatcher = ThreadWatcher.instance();
-        quietClose(traceReporter, refresher, server, shardServer, indexManager, indexServer, threadWatcher, clusterStatus, zooKeeper,
+        quietClose(traceStorage, refresher, server, shardServer, indexManager, indexServer, threadWatcher, clusterStatus, zooKeeper,
             httpServer);
       }
     };

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/cc606b47/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java b/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
index a7e240c..4cda152 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
@@ -54,9 +54,9 @@ import org.apache.blur.thrift.generated.Blur;
 import org.apache.blur.thrift.generated.Blur.Iface;
 import org.apache.blur.thrift.server.TThreadedSelectorServer;
 import org.apache.blur.thrift.server.TThreadedSelectorServer.Args.AcceptPolicy;
-import org.apache.blur.trace.LogTraceReporter;
-import org.apache.blur.trace.TraceReporter;
-import org.apache.blur.trace.ZooKeeperTraceReporter;
+import org.apache.blur.trace.LogTraceStorage;
+import org.apache.blur.trace.TraceStorage;
+import org.apache.blur.trace.ZooKeeperTraceStorage;
 
 import com.yammer.metrics.Metrics;
 import com.yammer.metrics.core.Gauge;
@@ -89,12 +89,12 @@ public class ThriftServer {
     _serverTransport = serverTransport;
   }
 
-  public static TraceReporter setupTraceReporter(BlurConfiguration configuration) throws IOException {
+  public static TraceStorage setupTraceStorage(BlurConfiguration configuration) throws IOException {
     String path = configuration.get(BLUR_ZOOKEEPER_TRACE_PATH);
     if (path == null || path.isEmpty()) {
-      return new LogTraceReporter(configuration);
+      return new LogTraceStorage(configuration);
     }
-    return new ZooKeeperTraceReporter(configuration);
+    return new ZooKeeperTraceStorage(configuration);
   }
 
   public static void printUlimits() throws IOException {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/cc606b47/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java b/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
index 1e004bf..c118b9c 100644
--- a/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
+++ b/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
@@ -798,7 +798,6 @@ public class BlurUtil {
     trace.done();
 
     Tracer trace2 = Trace.trace("fetching doc from index");
-    long readTime = 0;
     int totalHeap = 0;
     for (int i = start; i < end; i++) {
       if (i >= totalHits) {
@@ -810,16 +809,12 @@ public class BlurUtil {
         break;
       }
       int doc = scoreDocs.get(i).doc;
-      long s = System.nanoTime();
       indexSearcher.doc(doc, fieldSelector);
-      long e = System.nanoTime();
-      readTime += (e - s);
       docs.add(fieldSelector.getDocument());
       int heapSize = fieldSelector.getSize();
       totalHeap += heapSize;
       fieldSelector.reset();
     }
-    System.out.println("Read time " + readTime);
     trace2.done();
     return docs;
   }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/cc606b47/blur-core/src/test/java/org/apache/blur/manager/IndexManagerTest.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/manager/IndexManagerTest.java b/blur-core/src/test/java/org/apache/blur/manager/IndexManagerTest.java
index 2be0c9c..55cf481 100644
--- a/blur-core/src/test/java/org/apache/blur/manager/IndexManagerTest.java
+++ b/blur-core/src/test/java/org/apache/blur/manager/IndexManagerTest.java
@@ -71,9 +71,10 @@ import org.apache.blur.thrift.generated.Schema;
 import org.apache.blur.thrift.generated.ScoreType;
 import org.apache.blur.thrift.generated.Selector;
 import org.apache.blur.thrift.generated.TableDescriptor;
+import org.apache.blur.trace.BaseTraceStorage;
 import org.apache.blur.trace.Trace;
 import org.apache.blur.trace.TraceCollector;
-import org.apache.blur.trace.TraceReporter;
+import org.apache.blur.trace.TraceStorage;
 import org.apache.blur.utils.BlurConstants;
 import org.apache.blur.utils.BlurIterator;
 import org.apache.blur.utils.BlurUtil;
@@ -276,8 +277,8 @@ public class IndexManagerTest {
   public void testMutationReplaceLargeRow() throws Exception {
     final String rowId = "largerow";
     indexManager.mutate(getLargeRow(rowId));
-    TraceReporter oldReporter = Trace.getReporter();
-    Trace.setReporter(new TraceReporter(new BlurConfiguration()) {
+    TraceStorage oldReporter = Trace.getStorage();
+    Trace.setStorage(new BaseTraceStorage(new BlurConfiguration()) {
 
       @Override
       public void close() throws IOException {
@@ -285,7 +286,7 @@ public class IndexManagerTest {
       }
 
       @Override
-      public void report(TraceCollector collector) {
+      public void store(TraceCollector collector) {
         System.out.println(collector.toJson());
       }
     });
@@ -315,7 +316,7 @@ public class IndexManagerTest {
       thread.join();
     }
 
-    Trace.setReporter(oldReporter);
+    Trace.setStorage(oldReporter);
 
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/cc606b47/blur-gui/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/blur-gui/src/main/webapp/index.html b/blur-gui/src/main/webapp/index.html
index 09dba77..0d48058 100644
--- a/blur-gui/src/main/webapp/index.html
+++ b/blur-gui/src/main/webapp/index.html
@@ -16,16 +16,83 @@ KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 -->
-<meta HTTP-EQUIV="REFRESH" content="0;url=home.jsp"/>
 <html>
 <head>
-<title>Blur</title>
+<title>Blur - Home</title>
+<meta charset="utf-8">
+<link href="css/bootstrap.min.css" rel="stylesheet">
+<link href="css/bs-docs.css" rel="stylesheet" media="screen">
 </head>
+
+<script src="js/jquery-1.9.1.min.js"></script>
+<script src="js/thrift.js"></script>
+<script src="js/Blur.js"></script>
+<script src="js/Blur_types.js"></script>
+<script>
+function displayPage() {
+    var transport = new Thrift.Transport("/blur");
+    var protocol  = new Thrift.Protocol(transport);
+    var client    = new BlurClient(protocol);
+        
+    try {
+	  var clusters = client.shardClusterList();
+	  var body = $("#page_body");
+	  for (var i = 0; i < clusters.length; i++) {
+        var cluster = clusters[i];
+        body.append("<h1>Shard Server</h1>");
+
+        body.append("<h2>Tables [" + cluster + "]</h2>");
+	    var tables = client.tableListByCluster(cluster);
+	    tables.sort();
+	
+		var s = "<table border=1 class=\"table-bordered table-striped table-condensed\">";
+s += "<tr><th>Name</th><th>Enabled</th><th>Totals Shards</th><th>Online Shards</th><th>Location</th></tr>";
+		for (var t = 0; t < tables.length; t++) {
+		  var table = tables[t];
+          var descriptor = client.describe(table);
+          var layout = client.shardServerLayoutState(table);
+		  s += "<tr>";
+          s += "<td>"+descriptor.name+"</td>";
+          s += "<td>"+descriptor.enabled+"</td>";
+
+          s += "<td>"+descriptor.shardCount+"</td>";
+          s += "<td>"+Object.keys(layout).length+"</td>";
+          s += "<td>"+descriptor.tableUri+"</td>";
+		  s += "</tr>";
+		}
+		body.append(s + "</table>");
+
+        body.append("<h2>All Shard Servers in [" + cluster + "]</h2>");
+        var servers = client.shardServerList(cluster);
+        servers.sort();
+        var l = "<ul>";
+	    for (var t = 0; t < servers.length; t++) {
+		  var server = servers[t];
+		  var hostname = getHostName(server);
+		  l += "<li><a href=\"http://"+hostname+"\">" + server + "</a></li>";
+		}
+		body.append(l + "</ul>");
+      }
+    } catch(ouch){
+alert (ouch);
+    }
+}
+function getHostName(hostnamePlusPort) {
+  var indexOf = hostnamePlusPort.indexOf("\:");
+  var port = parseInt(hostnamePlusPort.substring(indexOf+1));
+  port+=70;
+  return hostnamePlusPort.substring(0,indexOf) + ":" + port;
+}
+$(window).bind("load", displayPage);
+</script>
 <body>
-<h1>Blur</h1>
+<table class="table-bordered table-condensed">
+	<tr><th><a href="index.html">Home</a> | 
+		<a href="config.html">Configuration</a> | 
+		<a href="metrics.html">Metrics</a> | 
+		<a href="traces.html">Traces</a></th></tr>
+	<tr><td id="page_body"></td></tr>
+</table>
 
-<ul>
-<li><a href="home.jsp">Blur Health/Status</a></li>
-</ul>
 </body>
 </html>

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/cc606b47/blur-gui/src/main/webapp/index2.html
----------------------------------------------------------------------
diff --git a/blur-gui/src/main/webapp/index2.html b/blur-gui/src/main/webapp/index2.html
deleted file mode 100644
index 0d48058..0000000
--- a/blur-gui/src/main/webapp/index2.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<html>
-<head>
-<title>Blur - Home</title>
-<meta charset="utf-8">
-<link href="css/bootstrap.min.css" rel="stylesheet">
-<link href="css/bs-docs.css" rel="stylesheet" media="screen">
-</head>
-
-<script src="js/jquery-1.9.1.min.js"></script>
-<script src="js/thrift.js"></script>
-<script src="js/Blur.js"></script>
-<script src="js/Blur_types.js"></script>
-<script>
-function displayPage() {
-    var transport = new Thrift.Transport("/blur");
-    var protocol  = new Thrift.Protocol(transport);
-    var client    = new BlurClient(protocol);
-        
-    try {
-	  var clusters = client.shardClusterList();
-	  var body = $("#page_body");
-	  for (var i = 0; i < clusters.length; i++) {
-        var cluster = clusters[i];
-        body.append("<h1>Shard Server</h1>");
-
-        body.append("<h2>Tables [" + cluster + "]</h2>");
-	    var tables = client.tableListByCluster(cluster);
-	    tables.sort();
-	
-		var s = "<table border=1 class=\"table-bordered table-striped table-condensed\">";
-s += "<tr><th>Name</th><th>Enabled</th><th>Totals Shards</th><th>Online Shards</th><th>Location</th></tr>";
-		for (var t = 0; t < tables.length; t++) {
-		  var table = tables[t];
-          var descriptor = client.describe(table);
-          var layout = client.shardServerLayoutState(table);
-		  s += "<tr>";
-          s += "<td>"+descriptor.name+"</td>";
-          s += "<td>"+descriptor.enabled+"</td>";
-
-          s += "<td>"+descriptor.shardCount+"</td>";
-          s += "<td>"+Object.keys(layout).length+"</td>";
-          s += "<td>"+descriptor.tableUri+"</td>";
-		  s += "</tr>";
-		}
-		body.append(s + "</table>");
-
-        body.append("<h2>All Shard Servers in [" + cluster + "]</h2>");
-        var servers = client.shardServerList(cluster);
-        servers.sort();
-        var l = "<ul>";
-	    for (var t = 0; t < servers.length; t++) {
-		  var server = servers[t];
-		  var hostname = getHostName(server);
-		  l += "<li><a href=\"http://"+hostname+"\">" + server + "</a></li>";
-		}
-		body.append(l + "</ul>");
-      }
-    } catch(ouch){
-alert (ouch);
-    }
-}
-function getHostName(hostnamePlusPort) {
-  var indexOf = hostnamePlusPort.indexOf("\:");
-  var port = parseInt(hostnamePlusPort.substring(indexOf+1));
-  port+=70;
-  return hostnamePlusPort.substring(0,indexOf) + ":" + port;
-}
-$(window).bind("load", displayPage);
-</script>
-<body>
-<table class="table-bordered table-condensed">
-	<tr><th><a href="index.html">Home</a> | 
-		<a href="config.html">Configuration</a> | 
-		<a href="metrics.html">Metrics</a> | 
-		<a href="traces.html">Traces</a></th></tr>
-	<tr><td id="page_body"></td></tr>
-</table>
-
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/cc606b47/blur-gui/src/main/webapp/js/Blur.js
----------------------------------------------------------------------
diff --git a/blur-gui/src/main/webapp/js/Blur.js b/blur-gui/src/main/webapp/js/Blur.js
index 25aed89..bc51fd3 100644
--- a/blur-gui/src/main/webapp/js/Blur.js
+++ b/blur-gui/src/main/webapp/js/Blur.js
@@ -4766,6 +4766,521 @@ Blur_startTrace_result.prototype.write = function(output) {
   return;
 };
 
+Blur_traceList_args = function(args) {
+};
+Blur_traceList_args.prototype = {};
+Blur_traceList_args.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    input.skip(ftype);
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+Blur_traceList_args.prototype.write = function(output) {
+  output.writeStructBegin('Blur_traceList_args');
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+Blur_traceList_result = function(args) {
+  this.success = null;
+  this.ex = null;
+  if (args instanceof BlurException) {
+    this.ex = args;
+    return;
+  }
+  if (args) {
+    if (args.success !== undefined) {
+      this.success = args.success;
+    }
+    if (args.ex !== undefined) {
+      this.ex = args.ex;
+    }
+  }
+};
+Blur_traceList_result.prototype = {};
+Blur_traceList_result.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 0:
+      if (ftype == Thrift.Type.LIST) {
+        var _size364 = 0;
+        var _rtmp3368;
+        this.success = [];
+        var _etype367 = 0;
+        _rtmp3368 = input.readListBegin();
+        _etype367 = _rtmp3368.etype;
+        _size364 = _rtmp3368.size;
+        for (var _i369 = 0; _i369 < _size364; ++_i369)
+        {
+          var elem370 = null;
+          elem370 = input.readString().value;
+          this.success.push(elem370);
+        }
+        input.readListEnd();
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 1:
+      if (ftype == Thrift.Type.STRUCT) {
+        this.ex = new BlurException();
+        this.ex.read(input);
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+Blur_traceList_result.prototype.write = function(output) {
+  output.writeStructBegin('Blur_traceList_result');
+  if (this.success !== null && this.success !== undefined) {
+    output.writeFieldBegin('success', Thrift.Type.LIST, 0);
+    output.writeListBegin(Thrift.Type.STRING, this.success.length);
+    for (var iter371 in this.success)
+    {
+      if (this.success.hasOwnProperty(iter371))
+      {
+        iter371 = this.success[iter371];
+        output.writeString(iter371);
+      }
+    }
+    output.writeListEnd();
+    output.writeFieldEnd();
+  }
+  if (this.ex !== null && this.ex !== undefined) {
+    output.writeFieldBegin('ex', Thrift.Type.STRUCT, 1);
+    this.ex.write(output);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+Blur_traceRequestList_args = function(args) {
+  this.traceId = null;
+  if (args) {
+    if (args.traceId !== undefined) {
+      this.traceId = args.traceId;
+    }
+  }
+};
+Blur_traceRequestList_args.prototype = {};
+Blur_traceRequestList_args.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 1:
+      if (ftype == Thrift.Type.STRING) {
+        this.traceId = input.readString().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 0:
+        input.skip(ftype);
+        break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+Blur_traceRequestList_args.prototype.write = function(output) {
+  output.writeStructBegin('Blur_traceRequestList_args');
+  if (this.traceId !== null && this.traceId !== undefined) {
+    output.writeFieldBegin('traceId', Thrift.Type.STRING, 1);
+    output.writeString(this.traceId);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+Blur_traceRequestList_result = function(args) {
+  this.success = null;
+  this.ex = null;
+  if (args instanceof BlurException) {
+    this.ex = args;
+    return;
+  }
+  if (args) {
+    if (args.success !== undefined) {
+      this.success = args.success;
+    }
+    if (args.ex !== undefined) {
+      this.ex = args.ex;
+    }
+  }
+};
+Blur_traceRequestList_result.prototype = {};
+Blur_traceRequestList_result.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 0:
+      if (ftype == Thrift.Type.LIST) {
+        var _size372 = 0;
+        var _rtmp3376;
+        this.success = [];
+        var _etype375 = 0;
+        _rtmp3376 = input.readListBegin();
+        _etype375 = _rtmp3376.etype;
+        _size372 = _rtmp3376.size;
+        for (var _i377 = 0; _i377 < _size372; ++_i377)
+        {
+          var elem378 = null;
+          elem378 = input.readString().value;
+          this.success.push(elem378);
+        }
+        input.readListEnd();
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 1:
+      if (ftype == Thrift.Type.STRUCT) {
+        this.ex = new BlurException();
+        this.ex.read(input);
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+Blur_traceRequestList_result.prototype.write = function(output) {
+  output.writeStructBegin('Blur_traceRequestList_result');
+  if (this.success !== null && this.success !== undefined) {
+    output.writeFieldBegin('success', Thrift.Type.LIST, 0);
+    output.writeListBegin(Thrift.Type.STRING, this.success.length);
+    for (var iter379 in this.success)
+    {
+      if (this.success.hasOwnProperty(iter379))
+      {
+        iter379 = this.success[iter379];
+        output.writeString(iter379);
+      }
+    }
+    output.writeListEnd();
+    output.writeFieldEnd();
+  }
+  if (this.ex !== null && this.ex !== undefined) {
+    output.writeFieldBegin('ex', Thrift.Type.STRUCT, 1);
+    this.ex.write(output);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+Blur_traceRequestFetch_args = function(args) {
+  this.traceId = null;
+  this.requestId = null;
+  if (args) {
+    if (args.traceId !== undefined) {
+      this.traceId = args.traceId;
+    }
+    if (args.requestId !== undefined) {
+      this.requestId = args.requestId;
+    }
+  }
+};
+Blur_traceRequestFetch_args.prototype = {};
+Blur_traceRequestFetch_args.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 1:
+      if (ftype == Thrift.Type.STRING) {
+        this.traceId = input.readString().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 2:
+      if (ftype == Thrift.Type.STRING) {
+        this.requestId = input.readString().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+Blur_traceRequestFetch_args.prototype.write = function(output) {
+  output.writeStructBegin('Blur_traceRequestFetch_args');
+  if (this.traceId !== null && this.traceId !== undefined) {
+    output.writeFieldBegin('traceId', Thrift.Type.STRING, 1);
+    output.writeString(this.traceId);
+    output.writeFieldEnd();
+  }
+  if (this.requestId !== null && this.requestId !== undefined) {
+    output.writeFieldBegin('requestId', Thrift.Type.STRING, 2);
+    output.writeString(this.requestId);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+Blur_traceRequestFetch_result = function(args) {
+  this.success = null;
+  this.ex = null;
+  if (args instanceof BlurException) {
+    this.ex = args;
+    return;
+  }
+  if (args) {
+    if (args.success !== undefined) {
+      this.success = args.success;
+    }
+    if (args.ex !== undefined) {
+      this.ex = args.ex;
+    }
+  }
+};
+Blur_traceRequestFetch_result.prototype = {};
+Blur_traceRequestFetch_result.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 0:
+      if (ftype == Thrift.Type.STRING) {
+        this.success = input.readString().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 1:
+      if (ftype == Thrift.Type.STRUCT) {
+        this.ex = new BlurException();
+        this.ex.read(input);
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+Blur_traceRequestFetch_result.prototype.write = function(output) {
+  output.writeStructBegin('Blur_traceRequestFetch_result');
+  if (this.success !== null && this.success !== undefined) {
+    output.writeFieldBegin('success', Thrift.Type.STRING, 0);
+    output.writeString(this.success);
+    output.writeFieldEnd();
+  }
+  if (this.ex !== null && this.ex !== undefined) {
+    output.writeFieldBegin('ex', Thrift.Type.STRUCT, 1);
+    this.ex.write(output);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+Blur_traceRemove_args = function(args) {
+  this.traceId = null;
+  if (args) {
+    if (args.traceId !== undefined) {
+      this.traceId = args.traceId;
+    }
+  }
+};
+Blur_traceRemove_args.prototype = {};
+Blur_traceRemove_args.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 1:
+      if (ftype == Thrift.Type.STRING) {
+        this.traceId = input.readString().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 0:
+        input.skip(ftype);
+        break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+Blur_traceRemove_args.prototype.write = function(output) {
+  output.writeStructBegin('Blur_traceRemove_args');
+  if (this.traceId !== null && this.traceId !== undefined) {
+    output.writeFieldBegin('traceId', Thrift.Type.STRING, 1);
+    output.writeString(this.traceId);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+Blur_traceRemove_result = function(args) {
+  this.ex = null;
+  if (args instanceof BlurException) {
+    this.ex = args;
+    return;
+  }
+  if (args) {
+    if (args.ex !== undefined) {
+      this.ex = args.ex;
+    }
+  }
+};
+Blur_traceRemove_result.prototype = {};
+Blur_traceRemove_result.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 1:
+      if (ftype == Thrift.Type.STRUCT) {
+        this.ex = new BlurException();
+        this.ex.read(input);
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 0:
+        input.skip(ftype);
+        break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+Blur_traceRemove_result.prototype.write = function(output) {
+  output.writeStructBegin('Blur_traceRemove_result');
+  if (this.ex !== null && this.ex !== undefined) {
+    output.writeFieldBegin('ex', Thrift.Type.STRUCT, 1);
+    this.ex.write(output);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
 BlurClient = function(input, output) {
     this.input = input;
     this.output = (!output) ? input : output;
@@ -6002,3 +6517,148 @@ BlurClient.prototype.send_startTrace = function(traceId, requestId) {
   this.output.writeMessageEnd();
   return this.output.getTransport().flush();
 };
+BlurClient.prototype.traceList = function() {
+  this.send_traceList();
+  return this.recv_traceList();
+};
+
+BlurClient.prototype.send_traceList = function() {
+  this.output.writeMessageBegin('traceList', Thrift.MessageType.CALL, this.seqid);
+  var args = new Blur_traceList_args();
+  args.write(this.output);
+  this.output.writeMessageEnd();
+  return this.output.getTransport().flush();
+};
+
+BlurClient.prototype.recv_traceList = function() {
+  var ret = this.input.readMessageBegin();
+  var fname = ret.fname;
+  var mtype = ret.mtype;
+  var rseqid = ret.rseqid;
+  if (mtype == Thrift.MessageType.EXCEPTION) {
+    var x = new Thrift.TApplicationException();
+    x.read(this.input);
+    this.input.readMessageEnd();
+    throw x;
+  }
+  var result = new Blur_traceList_result();
+  result.read(this.input);
+  this.input.readMessageEnd();
+
+  if (null !== result.ex) {
+    throw result.ex;
+  }
+  if (null !== result.success) {
+    return result.success;
+  }
+  throw 'traceList failed: unknown result';
+};
+BlurClient.prototype.traceRequestList = function(traceId) {
+  this.send_traceRequestList(traceId);
+  return this.recv_traceRequestList();
+};
+
+BlurClient.prototype.send_traceRequestList = function(traceId) {
+  this.output.writeMessageBegin('traceRequestList', Thrift.MessageType.CALL, this.seqid);
+  var args = new Blur_traceRequestList_args();
+  args.traceId = traceId;
+  args.write(this.output);
+  this.output.writeMessageEnd();
+  return this.output.getTransport().flush();
+};
+
+BlurClient.prototype.recv_traceRequestList = function() {
+  var ret = this.input.readMessageBegin();
+  var fname = ret.fname;
+  var mtype = ret.mtype;
+  var rseqid = ret.rseqid;
+  if (mtype == Thrift.MessageType.EXCEPTION) {
+    var x = new Thrift.TApplicationException();
+    x.read(this.input);
+    this.input.readMessageEnd();
+    throw x;
+  }
+  var result = new Blur_traceRequestList_result();
+  result.read(this.input);
+  this.input.readMessageEnd();
+
+  if (null !== result.ex) {
+    throw result.ex;
+  }
+  if (null !== result.success) {
+    return result.success;
+  }
+  throw 'traceRequestList failed: unknown result';
+};
+BlurClient.prototype.traceRequestFetch = function(traceId, requestId) {
+  this.send_traceRequestFetch(traceId, requestId);
+  return this.recv_traceRequestFetch();
+};
+
+BlurClient.prototype.send_traceRequestFetch = function(traceId, requestId) {
+  this.output.writeMessageBegin('traceRequestFetch', Thrift.MessageType.CALL, this.seqid);
+  var args = new Blur_traceRequestFetch_args();
+  args.traceId = traceId;
+  args.requestId = requestId;
+  args.write(this.output);
+  this.output.writeMessageEnd();
+  return this.output.getTransport().flush();
+};
+
+BlurClient.prototype.recv_traceRequestFetch = function() {
+  var ret = this.input.readMessageBegin();
+  var fname = ret.fname;
+  var mtype = ret.mtype;
+  var rseqid = ret.rseqid;
+  if (mtype == Thrift.MessageType.EXCEPTION) {
+    var x = new Thrift.TApplicationException();
+    x.read(this.input);
+    this.input.readMessageEnd();
+    throw x;
+  }
+  var result = new Blur_traceRequestFetch_result();
+  result.read(this.input);
+  this.input.readMessageEnd();
+
+  if (null !== result.ex) {
+    throw result.ex;
+  }
+  if (null !== result.success) {
+    return result.success;
+  }
+  throw 'traceRequestFetch failed: unknown result';
+};
+BlurClient.prototype.traceRemove = function(traceId) {
+  this.send_traceRemove(traceId);
+  this.recv_traceRemove();
+};
+
+BlurClient.prototype.send_traceRemove = function(traceId) {
+  this.output.writeMessageBegin('traceRemove', Thrift.MessageType.CALL, this.seqid);
+  var args = new Blur_traceRemove_args();
+  args.traceId = traceId;
+  args.write(this.output);
+  this.output.writeMessageEnd();
+  return this.output.getTransport().flush();
+};
+
+BlurClient.prototype.recv_traceRemove = function() {
+  var ret = this.input.readMessageBegin();
+  var fname = ret.fname;
+  var mtype = ret.mtype;
+  var rseqid = ret.rseqid;
+  if (mtype == Thrift.MessageType.EXCEPTION) {
+    var x = new Thrift.TApplicationException();
+    x.read(this.input);
+    this.input.readMessageEnd();
+    throw x;
+  }
+  var result = new Blur_traceRemove_result();
+  result.read(this.input);
+  this.input.readMessageEnd();
+
+  if (null !== result.ex) {
+    throw result.ex;
+  }
+  return;
+};

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/cc606b47/blur-gui/src/main/webapp/metrics.html
----------------------------------------------------------------------
diff --git a/blur-gui/src/main/webapp/metrics.html b/blur-gui/src/main/webapp/metrics.html
index 68de457..c5f6f48 100644
--- a/blur-gui/src/main/webapp/metrics.html
+++ b/blur-gui/src/main/webapp/metrics.html
@@ -38,9 +38,10 @@ function displayPage() {
 	  var metrics = client.metrics(null);
 	  var body = $("#page_body");
 	  var keys = Object.keys(metrics).sort();
-	  body.append("<h1>Shard Server</h1>");
-      body.append("<h2>Metrics</h2>");
-      var s = "<table border=1 class=\"table-bordered table-striped table-condensed\"><tr><th>Name</th><th>Value</th></tr>";
+      var s = "";
+	  s += "<h1>Shard Server</h1>";
+      s += "<h2>Metrics</h2>";
+      s += "<table border=1 class=\"table-bordered table-striped table-condensed\"><tr><th>Name</th><th>Value</th></tr>";
 	  for (var i = 0; i < keys.length; i++) {
         var key = keys[i];
         var metric = metrics[key];
@@ -51,10 +52,11 @@ function displayPage() {
 		s += "</td></tr>";
       }
       s += "</table>";
-      body.append(s);
+      body.html(s);
     } catch(ouch){
-alert (ouch);
+      alert (ouch);
     }
+    setTimeout(displayPage,3000);
 }
 function writeValueMap(metrics,key,map,formatNumber) {
   if (map) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/cc606b47/blur-gui/src/main/webapp/traces.html
----------------------------------------------------------------------
diff --git a/blur-gui/src/main/webapp/traces.html b/blur-gui/src/main/webapp/traces.html
index e69de29..d7d92e9 100644
--- a/blur-gui/src/main/webapp/traces.html
+++ b/blur-gui/src/main/webapp/traces.html
@@ -0,0 +1,264 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<html>
+<head>
+<title>Blur - Traces</title>
+<meta charset="utf-8">
+<link href="css/bootstrap.min.css" rel="stylesheet">
+<link href="css/bs-docs.css" rel="stylesheet" media="screen">
+</head>
+
+<script src="js/jquery-1.9.1.min.js"></script>
+<script src="js/thrift.js"></script>
+<script src="js/Blur.js"></script>
+<script src="js/Blur_types.js"></script>
+<script>
+var transport = new Thrift.Transport("/blur");
+var protocol  = new Thrift.Protocol(transport);
+var client    = new BlurClient(protocol);
+function displayPage() {
+    try {
+	  var traceList = client.traceList();
+	  var body = $("#page_body");
+	  var lst = traceList.sort();
+      var s = "<table border=1 class=\"table-bordered table-striped table-condensed\"><tr><th>Trace Id</th><th>Time</th></tr>";
+	  for (var i = 0; i < lst.length; i++) {
+		var traceId = lst[i];
+        s += "<tr><td nowrap=1><a title=\""+traceId+"\" id=\"traceid_"+traceId+"\" href=\"#\">"+shortenString(traceId)+"</a><td nowrap=1>"+getTraceTime(traceId,client)+"</td></td></tr>";
+      }
+      body.html(s + "</table>");
+	  for (var i = 0; i < lst.length; i++) {
+		var traceId = lst[i];
+        $("#traceid_"+traceId).click(function(){ displayRequestIds(event.target.id); return false; });
+      }
+
+    } catch(ouch){
+      if (window.console) console.log(ouch);
+    }
+    setTimeout(displayPage,5000);
+}
+function shortenString(traceId) {
+return traceId.substring(0,6) + "..." + traceId.substring(traceId.length - 6,traceId.length);
+}
+function getTraceTime(traceId,client){
+  var lst = client.traceRequestList(traceId);
+  if (lst.length == 0) {
+	return "unknown";
+  }
+  var info = getRequestInfo(client,traceId,traceId);
+  return formatTimeNoNano(info.created);
+}
+function displayRequestIds(traceIdAttr) {
+	var parts = traceIdAttr.split("_");
+	traceId = parts[1];
+	$("#trace_contents").html("No Request Selected");
+    try {
+	  var traceRequestList = client.traceRequestList(traceId);
+	  var rbody = $("#request_id_body");
+	  var lst = traceRequestList.sort();
+      var s = "<table border=1 class=\"table-bordered table-striped table-condensed\"><tr><th nowrap=1>Request Id</th><th nowrap=1>Time Offset (ms)</th></tr>";
+      var requestArray = new Array();
+	  for (var i = 0; i < lst.length; i++) {
+		var info = getRequestInfo(client,traceId,lst[i]);
+		info.requestId = lst[i];
+		requestArray.push(info);
+      }
+      requestArray.sort(function(a,b){
+	    if (a.created < b.created) {
+		  return -1;
+	    } else if (a.created > b.created) {
+		  return 1;
+	    }
+	    return 0;
+      });
+      var lastTime = 0;
+	  for (var i = 0; i < requestArray.length; i++) {
+		var id = "requestid_"+traceId+"_"+requestArray[i].requestId;
+		if (traceId == requestArray[i].requestId) {
+		  s += "<tr><td nowrap=1><a id=\""+id+"\" href=\"#\">"+requestArray[i].nodeName+" (Root)</a></td>";
+          s += "<td>0</td>";
+		  s += "</tr>";
+		} else {
+          s += "<tr><td nowrap=1><a id=\""+id+"\" href=\"#\">"+requestArray[i].nodeName+" (Request "+i+")</a></td>";
+          var diff = requestArray[i].created - lastTime;
+          s += "<td>"+diff / 1000000+"</td>";
+		  s += "</tr>";
+        }
+		lastTime = requestArray[i].created;
+      }
+      rbody.html(s + "</table>");
+	  for (var i = 0; i < lst.length; i++) {
+		var requestId = lst[i];
+        $("#requestid_"+traceId+"_"+requestId).click(
+	      function(event){
+            displayTrace(event.target.id);
+		    return false;
+		  });
+      }
+    } catch(ouch){
+      if (window.console) console.log(ouch);
+    }
+}
+function getRequestInfo(client,traceId,requestId) {
+  var json = client.traceRequestFetch(traceId,requestId);
+  var traceRequest = $.parseJSON(json);
+  var result = {};
+  result.created = traceRequest.created;
+  result.nodeName = traceRequest.nodeName;
+  return result;
+}
+function displayTrace(traceIdPlusRequestId) {
+  var parts = traceIdPlusRequestId.split("_");
+  var traceId = parts[1];
+  var requestId = parts[2];
+
+  var requestIds = client.traceRequestList(traceId);
+
+  var json = client.traceRequestFetch(traceId,requestId);
+  var traceRequest = $.parseJSON(json);
+  var ids = new Array();
+  var header = "<table border=1 class=\"table-bordered table-striped table-condensed\">";
+  header += "<tr><th>Node</th><th>Pid</th><th>Main Thread</th><th>Create Time</th></tr>";
+  header += "<tr><td>" + traceRequest.nodeName + "</td>";
+  header += "<td>" + traceRequest.pid + "</td>";
+  header += "<td>" + traceRequest.thread + "</td>";
+  header += "<td>" + formatTime(traceRequest.created) + "</td></tr>";
+  header += "</table><br/>";
+  var s = gatherTraceInfo(traceRequest,requestIds,traceId,ids);
+  $("#trace_contents").html(header + s);
+  for (var i = 0; i < ids.length; i++) {
+    $("#"+ids[i]).click(
+      function(event){
+        displayTrace(event.target.id);
+        return false;
+      });
+  }
+}
+function formatTimeNoNano(t) {
+  var d = new Date(0);
+  d.setUTCMilliseconds(t / 1000000);
+  var date = d.getDate();
+  var month = d.getMonth();
+  month++;
+  var year = d.getFullYear();
+  var hours = d.getHours();
+  var minutes = d.getMinutes();
+  var seconds = d.getSeconds();
+  var millis = d.getMilliseconds();
+  return year + "-" + bufDigits(month,2) + "-" + bufDigits(date,2) + " " + bufDigits(hours,2) + ":" + bufDigits(minutes,2) + ":"  + bufDigits(seconds,2) + "." + bufDigits(millis,3);
+}
+function formatTime(t) {
+  var nanos = t % 1000000;
+  var d = new Date(0);
+  d.setUTCMilliseconds(t / 1000000);
+  var date = d.getDate();
+  var month = d.getMonth();
+  month++;
+  var year = d.getFullYear();
+  var hours = d.getHours();
+  var minutes = d.getMinutes();
+  var seconds = d.getSeconds();
+  var millis = d.getMilliseconds();
+  return year + "-" + bufDigits(month,2) + "-" + bufDigits(date,2) + " " + bufDigits(hours,2) + ":" + bufDigits(minutes,2) + ":"  + bufDigits(seconds,2) + "." + bufDigits(millis,3) + "."+bufDigits(nanos,6);
+}
+function bufDigits(num,len) {
+  num = num + "";
+  while (num.length < len) {
+    num = "0" + num;
+  }
+  return num;
+}
+function gatherTraceInfo(collector,requestIds,traceId,ids) {
+  var traces = collector.traces;
+  var s = "<table border=1 class=\"table-bordered table-striped table-condensed\">";
+  s += "<tr><th>Trace Name</th><th>Thread</th><th>Scope</th><th>Time (ms)</th></tr>";
+  for (var i = 0; i < traces.length; i++) {
+    var trace = traces[i];
+
+    var colName = "<td valign=top nowrap=1>";
+    var colValue = "<td valign=top nowrap=1>";
+    if (trace.collector) {
+      var requestIdInAnotherProcess = getNewRequestId(trace.collector,requestIds)
+      if (requestIdInAnotherProcess) {
+        var id = "requestid_"+traceId+"_"+requestIdInAnotherProcess + "_2";
+        ids.push(id);
+        colName += "<a href=\"#\" id=\""+id+"\">" + trace.id + " - " + trace.name + "</a>";
+        colValue += gatherTraceInfo(trace.collector,requestIds,traceId,ids);
+      } else {
+        colName += trace.id + " - " + trace.name + "</td>";
+        colValue += gatherTraceInfo(trace.collector,requestIds,traceId,ids);
+      }
+    } else {
+	  colName += trace.id + " - " + trace.name;
+	  colValue += (trace.took / 1000000.0).toPrecision(6);
+    }
+    s += "<tr>";
+    s += colName + "</td>";
+    s += "<td valign=top nowrap=1>"+trace.thread+"</td>";
+    s += "<td valign=top nowrap=1>"+trace.scope+"</td>";
+    s += colValue + "</td>";
+    s += getParams(trace);
+  }
+  s += "</table>";
+  return s;
+}
+function getParams(trace) {
+  var s = "";
+  if (trace.parameters) {
+    var parameters = trace.parameters;
+	if (parameters.length > 0) {
+      s += "</tr><tr><td valign=top align=right><b>Parameters:</b></td><td valign=top colspan=3>"
+      for (var i = 0; i < parameters.length; i++) {
+        var parameter = parameters[i];
+        var keys = Object.keys(parameter);
+        for (var t = 0; t < keys.length; t++) {
+          var key = keys[t];
+          var value = parameter[key];
+    	      s += key + "=" + value + "<br/>";
+        }
+      }
+    }
+    s += "</td>";
+  }
+  s += "</tr>";
+  return s;
+}
+function getNewRequestId(collector,requestIds) {
+  if ($.inArray(collector.id.requestId, requestIds) != -1) {
+    return collector.id.requestId;	
+  }
+  return null;
+}
+$(window).bind("load", displayPage);
+</script>
+<body>
+	<table class="table-bordered table-condensed">
+		<tr><th colspan=3><a href="index.html">Home</a> | 
+			<a href="config.html">Configuration</a> | 
+			<a href="metrics.html">Metrics</a> | 
+			<a href="traces.html">Traces</a></th></tr>
+	    <tr><td colspan=3 valign="top"><h1>System Traces</h1></td></tr>
+		<tr><td valign="top"><h2>Traces</h2><div id="page_body"></div></td>
+			<td valign="top"><h2>Requests</h2><div id="request_id_body"></div></td>
+			<td valign="top"><h2>Trace Contents</h2><div id="trace_contents"></div></td></tr>
+	</table>
+
+
+</body>
+</html>


Mime
View raw message