incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [38/47] simple log viewer and metrics servlet
Date Mon, 03 Sep 2012 00:32:20 GMT
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ab40a9a3/src/blur-gui/src/main/webapps/controller/shardList.jsp
----------------------------------------------------------------------
diff --git a/src/blur-gui/src/main/webapps/controller/shardList.jsp b/src/blur-gui/src/main/webapps/controller/shardList.jsp
index f539343..a746e78 100644
--- a/src/blur-gui/src/main/webapps/controller/shardList.jsp
+++ b/src/blur-gui/src/main/webapps/controller/shardList.jsp
@@ -12,7 +12,12 @@
 		List<String> servers = client.shardServerList("default");
 		
 		for(String s : servers) {
-			ret += row(s,"","");
+			String[] split = s.split(":");
+			int base = Integer.parseInt(System.getProperty("blur.base.shard.port"));
+			int offset = Integer.parseInt(split[1])-base;
+			int baseShardPort = Integer.parseInt(System.getProperty("baseGuiShardPort"));
+			ret += row("<a href='http://" + split[0] + ":" + (baseShardPort + offset) + "'>"
+ s + "</a>","","");
+			
 		}
 		return ret;
 	}
@@ -20,7 +25,7 @@
 
 <%
 	//TODO: prop file the port
-	String hostName = request.getServerName() + ":40010";
+	String hostName = request.getServerName() + ":" + System.getProperty("blur.gui.servicing.port");
 
 	Iface client = BlurClient.getClient(hostName);
 
@@ -51,5 +56,6 @@
 		}
 	%>
 	<br/>
+	<a href="index.html">home</a> | <a href="logs">logs</a>
 </body>
 </html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ab40a9a3/src/blur-gui/src/main/webapps/controller/table.jsp
----------------------------------------------------------------------
diff --git a/src/blur-gui/src/main/webapps/controller/table.jsp b/src/blur-gui/src/main/webapps/controller/table.jsp
index 4aa15b9..ae662f0 100644
--- a/src/blur-gui/src/main/webapps/controller/table.jsp
+++ b/src/blur-gui/src/main/webapps/controller/table.jsp
@@ -78,7 +78,7 @@
 <%
 	final String NONE = "none given";
 
-	String hostName = request.getServerName() + ":40010";
+	String hostName = request.getServerName() + ":" + System.getProperty("blur.gui.servicing.port");
 
 	Iface client = BlurClient.getClient(hostName);
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ab40a9a3/src/blur-gui/src/main/webapps/controller/test.html
----------------------------------------------------------------------
diff --git a/src/blur-gui/src/main/webapps/controller/test.html b/src/blur-gui/src/main/webapps/controller/test.html
new file mode 100644
index 0000000..c73c263
--- /dev/null
+++ b/src/blur-gui/src/main/webapps/controller/test.html
@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+svg {
+	font: 10px sans-serif;
+}
+
+.line {
+	fill: none;
+	stroke: #000;
+	stroke-width: 1.5px;
+}
+
+.axis path,.axis line {
+	fill: none;
+	stroke: #000;
+	shape-rendering: crispEdges;
+}
+
+div { 
+	background: #CCC;
+}
+
+</style>
+
+</head>
+
+<script src="d3.v2.js"></script>
+<body>
+	<script>
+		//decimal formatter
+		var df = d3.format("4d");
+		//data holder
+		var dummy = [];
+		
+		var total = 10;
+		for(i=0;i<total-1;i++)
+			dummy.push(0);
+		
+		var div = null;
+
+		//not sure why i have to init inside the json method
+		d3.json("metrics", function(json) {
+			dummy.push(d3.round(json.methodCalls.mutate.invokes
+					/ (json.methodCalls.mutate.times / 1000000000.0), 3));
+
+			//select obj and bind data
+			div = d3.select("body")
+						.selectAll("div")
+						.data(dummy)
+						.enter()
+						.append("div")
+						.append("p")
+						.text(function(d) { return d + " mutates/s"});
+			dummy.shift();
+		
+		});
+
+		if(dummy === undefined)
+			alert("no metrics for mutates");
+
+		function tock() {
+			d3.json("metrics", function(json) {
+				dummy.push(d3.round(json.methodCalls.mutate.invokes
+						/ (json.methodCalls.mutate.times / 1000000000.0), 3));
+
+				alert("dummy.length: " + dummy.length + " dummy: " + dummy);
+	
+				div.transition()
+					.duration(1000)
+					.ease("linear")
+					//.text(function(d,i) { alert(d + " " + i);return d + " mutates/s"})
+					.each("end",tock());
+				dummy.shift();
+			});
+		}
+
+		tock();
+		
+		//after data add?
+//		div.enter().append("span").text(function(d) {
+//			return d + "<br/>\n";
+//		})
+
+
+	</script>
+
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ab40a9a3/src/blur-gui/src/main/webapps/shard/shard.jsp
----------------------------------------------------------------------
diff --git a/src/blur-gui/src/main/webapps/shard/shard.jsp b/src/blur-gui/src/main/webapps/shard/shard.jsp
index 8e36706..e28f370 100644
--- a/src/blur-gui/src/main/webapps/shard/shard.jsp
+++ b/src/blur-gui/src/main/webapps/shard/shard.jsp
@@ -72,7 +72,7 @@
 	}%>
 <%
 	//TODO: prop file the port
-	String hostName = request.getServerName() + ":40010";
+	String hostName = request.getServerName() + ":" + System.getProperty("blur.gui.servicing.port");
 
 	Iface client = BlurClient.getClient(hostName);
 %>
@@ -90,17 +90,28 @@
 	</h1>
 	<br />
 	<h2>Controllers</h2>
-
+	<%=table(getControllers(client),"Name","Online") %>
 	<hr />
 	<br />
 	<h2>Clusters</h2>
+	<%=table(getClusters(client),"Cluster Name","Shard Servers","Enabled") %>
 	<hr />
 	<br />
 	<h2>Tables</h2>
+	<%=table(getTables(client),"Cluster Name","Table Name","Enabled")%>
 	<hr />
 	<br />
 	<h2>Configs</h2>
-
+	<table class="statTable" class="statTableTitle">
+		<tr>
+			<td class="statTableTitle">Param</td>
+			<td class="statTableTitle">Value</td>
+		</tr>
+		<%=getConf(client)%>
+	</table>
+	<hr />
+	<br />
+	<a href="logs">logs</a>
 </body>
 
 </html>

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ab40a9a3/src/blur-gui/src/main/webapps/shard/style.css
----------------------------------------------------------------------
diff --git a/src/blur-gui/src/main/webapps/shard/style.css b/src/blur-gui/src/main/webapps/shard/style.css
new file mode 100644
index 0000000..cda4fb7
--- /dev/null
+++ b/src/blur-gui/src/main/webapps/shard/style.css
@@ -0,0 +1,53 @@
+body {
+	font-family: sans-serif;
+	font-size: 11px;
+	line-height: 17px;
+}
+
+a {
+    color: #0044FF !important;
+    text-decoration: none !important;
+}
+
+h2 {
+	margin: 5px 5px 0px 0px;
+}
+
+hr {
+	-moz-border-bottom-colors: none;
+	-moz-border-image: none;
+	-moz-border-left-colors: none;
+	-moz-border-right-colors: none;
+	-moz-border-top-colors: none;
+	border-color: -moz-use-text-color #DDDDDD #DDDDDD;
+	border-right: 1px solid #DDDDDD;
+	border-style: none solid solid;
+	border-width: 0 1px 1px;
+}
+
+table {
+	font-size: 12px;
+	
+}
+
+td {
+	align: left;
+	font-size: 12px;
+	padding-left: 10px;
+	padding-right: 10px;
+	font-family: Verdana;
+}
+
+.statTable {
+	width: 500px;
+}
+
+.statTableTitle {
+	color: 55555;
+	align: left;
+	font-weight: bold;
+	font-size:14pt;
+	padding: 10px 5px 0px 5px;
+	font-family: Helvetica;
+	background-color: #DDDDDD;
+}
\ No newline at end of file


Mime
View raw message