accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bil...@apache.org
Subject svn commit: r1296421 - in /incubator/accumulo/branches/1.4/src/server/src/main: java/org/apache/accumulo/server/monitor/servlets/VisServlet.java java/org/apache/accumulo/server/monitor/servlets/XMLServlet.java resources/web/vis.xml
Date Fri, 02 Mar 2012 19:59:59 GMT
Author: billie
Date: Fri Mar  2 19:59:58 2012
New Revision: 1296421

URL: http://svn.apache.org/viewvc?rev=1296421&view=rev
Log:
ACCUMULO-431 improved info box

Modified:
    incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/VisServlet.java
    incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/XMLServlet.java
    incubator/accumulo/branches/1.4/src/server/src/main/resources/web/vis.xml

Modified: incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/VisServlet.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/VisServlet.java?rev=1296421&r1=1296420&r2=1296421&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/VisServlet.java
(original)
+++ incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/VisServlet.java
Fri Mar  2 19:59:58 2012
@@ -191,6 +191,15 @@ public class VisServlet extends BasicSer
     // canvas
     sb.append("<br><canvas id='visCanvas' width='").append(width).append("' height='").append(height).append("'>Browser
does not support canvas.</canvas>\n\n");
     sb.append("</div>\n\n");
+  }
+  
+  private void addOptions(StringBuilder sb, StatType selectedStatType) {
+    for (StatType st : StatType.values()) {
+      sb.append("<option").append(st.equals(selectedStatType) ? " selected='true'>"
: ">").append(st.getDescription()).append("</option>");
+    }
+  }
+  
+  private void doScript(StringBuilder sb, ArrayList<TabletServerStatus> tservers) {
     // initialization of some javascript variables
     sb.append("<script type='text/javascript'>\n");
     sb.append("var numCores = " + ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors()
+ ";\n");
@@ -220,15 +229,7 @@ public class VisServlet extends BasicSer
     sb.append("]; // values will be converted by floor(this*value)/this\n");
     sb.append("var numNormalStats = ").append(StatType.values().length - StatType.numDerived()).append(";\n");
     sb.append("</script>\n");
-  }
-  
-  private void addOptions(StringBuilder sb, StatType selectedStatType) {
-    for (StatType st : StatType.values()) {
-      sb.append("<option").append(st.equals(selectedStatType) ? " selected='true'>"
: ">").append(st.getDescription()).append("</option>");
-    }
-  }
-  
-  private void doScript(StringBuilder sb, ArrayList<TabletServerStatus> tservers) {
+    
     InputStream data = VisServlet.class.getClassLoader().getResourceAsStream("web/vis.xml");
     if (data != null) {
       byte[] buffer = new byte[1024];

Modified: incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/XMLServlet.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/XMLServlet.java?rev=1296421&r1=1296420&r2=1296421&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/XMLServlet.java
(original)
+++ incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/XMLServlet.java
Fri Mar  2 19:59:58 2012
@@ -33,6 +33,7 @@ import org.apache.accumulo.core.master.t
 import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.master.state.TabletServerState;
 import org.apache.accumulo.server.monitor.Monitor;
+import org.apache.accumulo.server.monitor.util.celltypes.TServerLinkType;
 
 public class XMLServlet extends BasicServlet {
   private static final long serialVersionUID = 1L;
@@ -66,6 +67,7 @@ public class XMLServlet extends BasicSer
     for (TabletServerStatus status : Monitor.getMmi().tServerInfo) {
       
       sb.append("\n<server id='").append(status.name).append("'>\n");
+      sb.append("<hostname>").append(TServerLinkType.displayName(status.name)).append("</hostname>");
       sb.append("<lastContact>").append(System.currentTimeMillis() - status.lastContact).append("</lastContact>\n");
       sb.append("<osload>").append(status.osLoad).append("</osload>\n");
       

Modified: incubator/accumulo/branches/1.4/src/server/src/main/resources/web/vis.xml
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/server/src/main/resources/web/vis.xml?rev=1296421&r1=1296420&r2=1296421&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/server/src/main/resources/web/vis.xml (original)
+++ incubator/accumulo/branches/1.4/src/server/src/main/resources/web/vis.xml Fri Mar  2 19:59:58
2012
@@ -85,14 +85,17 @@ function handleNewData() {
   var deadinfo = xmlhttp.responseXML.getElementsByTagName('deadTabletServer');
   var badinfo = xmlhttp.responseXML.getElementsByTagName('badTabletServer');
   var idinfo = xmlhttp.responseXML.getElementsByTagName('server');
+  var hostinfo = xmlhttp.responseXML.getElementsByTagName('hostname');
   
   var statValues = new Array(numNormalStats);
   for (i=0; i < idinfo.length; i++) {
     var info = idinfo[i].attributes[0].nodeValue;
-    var extra = '<br>';
+    var extra = ' (' + hostinfo[i].childNodes[0].nodeValue + ')';
     for (j=0; j < numNormalStats; j++) {
+      if (j % 4 == 0)
+        extra = extra + '<br>\n';
       statValues[j] = Math.max(0,Math.floor(significance[j]*parseFloat(statinfo[j][i].childNodes[0].nodeValue))/significance[j]);
-      extra = extra + ' ' + statName[j] + ': ' + statValues[j];
+      extra = extra + '&nbsp;&nbsp;' + statName[j] + ': <strong>' + statValues[j]
+ '</strong>';
     }
     setStats(statValues,i);
     setDotInfo(info,extra,i);
@@ -129,22 +132,27 @@ function setStats(statValues,index) {
 function setOverallStats(statValues) {
   avgStat = 0;
   maxStat = 0;
+  maxIndex = 0;
   for (j=0; j < numNormalStats; j++) {
     normStat = statValues[j]/maxStatValue[j];
     if (normStat > 0)
       avgStat += normStat;
-    maxStat = Math.max(maxStat,normStat);
+    if (maxStat < normStat) {
+      maxStat = normStat;
+      maxIndex = j;
+    }
   }
   avgStat = avgStat/numNormalStats;
   maxStat = Math.min(1,maxStat);
   statValues[numNormalStats] = Math.floor(significance[numNormalStats]*avgStat)/significance[numNormalStats];
   statValues[numNormalStats+1] = Math.floor(significance[numNormalStats+1]*maxStat)/significance[numNormalStats+1];
+  return maxIndex;
 }
 
 function resetOverallStats() {
   for (i=0; i < numLive; i++) {
-    setOverallStats(allStats[i]);
-    extras[i] = extras[i] + ' avg: ' + allStats[i][numNormalStats] + ' max: ' + allStats[i][numNormalStats+1];
+    maxIndex = setOverallStats(allStats[i]);
+    extras[i] = extras[i] + '<br>\n&nbsp;&nbsp;avg: <strong>' + allStats[i][numNormalStats]
+ '</strong>&nbsp;&nbsp;max: <strong>' + allStats[i][numNormalStats+1]
+ '</strong> (' + statName[maxIndex] + ')';
   }
 }
 
@@ -209,7 +217,7 @@ function drawDots(){
       drawDot(x,y,Math.floor(dotSize[i]),getColor(getStat(i,colorStatType)));
   }
   if (mousedDot < numDots)
-    document.getElementById('vishoverinfo').innerHTML=ids[mousedDot]+extras[mousedDot];
+    document.getElementById('vishoverinfo').innerHTML='<strong>' + ids[mousedDot] +
'</strong>' + extras[mousedDot];
 }
 
 // fill in a few grey dots
@@ -360,7 +368,7 @@ function showId(e) {
   mousedDot = Math.floor(relx/(dotSpacing*2)) + width*Math.floor(rely/(dotSpacing*2));
   if (relx < (width*dotSpacing*2) && mousedDot < numDots) {
     document.getElementById('vishoverinfo').style.left=relx+canvas.offsetLeft;
-    document.getElementById('vishoverinfo').style.top=rely+canvas.offsetTop-40;
+    document.getElementById('vishoverinfo').style.top=Math.max(0,rely+canvas.offsetTop-70);
     document.getElementById('vishoverinfo').style.visibility='visible';
   }
   else {



Mime
View raw message