incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Added a new graph.
Date Tue, 11 Sep 2012 12:24:42 GMT
Updated Branches:
  refs/heads/master f61233ce7 -> fefe85784


Added a new graph.


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

Branch: refs/heads/master
Commit: fefe857846672c33c4276e9261153191dcfc78cd
Parents: f61233c
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Sep 11 08:24:17 2012 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Sep 11 08:24:17 2012 -0400

----------------------------------------------------------------------
 .../org/apache/blur/gui/LiveMetricsServlet.java    |    7 ++-
 src/blur-gui/src/main/webapp/livemetrics.jsp       |    6 +-
 .../java/org/apache/blur/metrics/QueryMetrics.java |   54 ++++++++++++--
 3 files changed, 55 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fefe8578/src/blur-gui/src/main/java/org/apache/blur/gui/LiveMetricsServlet.java
----------------------------------------------------------------------
diff --git a/src/blur-gui/src/main/java/org/apache/blur/gui/LiveMetricsServlet.java b/src/blur-gui/src/main/java/org/apache/blur/gui/LiveMetricsServlet.java
index 0a234f6..295f7c7 100644
--- a/src/blur-gui/src/main/java/org/apache/blur/gui/LiveMetricsServlet.java
+++ b/src/blur-gui/src/main/java/org/apache/blur/gui/LiveMetricsServlet.java
@@ -49,8 +49,11 @@ public class LiveMetricsServlet extends HttpServlet {
     out.write("\"jvm\":{\"xLabel\":\"Time\",\"yLabel\":\"Heap (GB)\",\"lines\":");
     heapMetrics.writeJson(out);
     out.write("}");
-    out.write(",\"blur\":{\"xLabel\":\"Time\",\"yLabel\":\"Rates\",\"lines\":");
-    queryMetrics.writeJson(out);
+    out.write(",\"blur_calls\":{\"xLabel\":\"Time\",\"yLabel\":\"Rates\",\"lines\":");
+    queryMetrics.writeGraph1Json(out);
+    out.write("}");
+    out.write(",\"blur_recordRates\":{\"xLabel\":\"Time\",\"yLabel\":\"Rates\",\"lines\":");
+    queryMetrics.writeGraph2Json(out);
     out.write("}");
     out.write(",\"system\":{\"xLabel\":\"Time\",\"yLabel\":\"Load\",\"lines\":");
     systemLoadMetrics.writeJson(out);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fefe8578/src/blur-gui/src/main/webapp/livemetrics.jsp
----------------------------------------------------------------------
diff --git a/src/blur-gui/src/main/webapp/livemetrics.jsp b/src/blur-gui/src/main/webapp/livemetrics.jsp
index 45d636a..1f437dd 100644
--- a/src/blur-gui/src/main/webapp/livemetrics.jsp
+++ b/src/blur-gui/src/main/webapp/livemetrics.jsp
@@ -103,8 +103,10 @@ drawGraphs("/livemetrics", margin, width, height)
 </h1>
 <h3>JVM Heap / Committed Heap</h3>
 <div id="jvm"></div>
-<h3>Blur Queries / Fetches / Mutates</h3>
-<div id="blur"></div>
+<h3>Blur Queries / Fetches / Mutates Requests</h3>
+<div id="blur_calls"></div>
+<h3>Blur Fetches / Mutates Record Rates</h3>
+<div id="blur_recordRates"></div>
 <h3>System Load</h3>
 <div id="system"></div>
 <%@ include file="footer.jsp" %>

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fefe8578/src/blur-util/src/main/java/org/apache/blur/metrics/QueryMetrics.java
----------------------------------------------------------------------
diff --git a/src/blur-util/src/main/java/org/apache/blur/metrics/QueryMetrics.java b/src/blur-util/src/main/java/org/apache/blur/metrics/QueryMetrics.java
index 80bf733..5fafc5a 100644
--- a/src/blur-util/src/main/java/org/apache/blur/metrics/QueryMetrics.java
+++ b/src/blur-util/src/main/java/org/apache/blur/metrics/QueryMetrics.java
@@ -23,10 +23,12 @@ public class QueryMetrics extends TimerTask {
   private final double[] _queryRate = new double[sampleSize];
   private final double[] _queryResponse = new double[sampleSize];
   private final double[] _queryExceptionRate = new double[sampleSize];
-  private final double[] _fetchRecordRate = new double[sampleSize];
+  private final double[] _fetchRate = new double[sampleSize];
   private final double[] _fetchResponse = new double[sampleSize];
-  private final double[] _mutateRecordRate = new double[sampleSize];
+  private final double[] _fetchRecordRate = new double[sampleSize];
+  private final double[] _mutateRate = new double[sampleSize];
   private final double[] _mutateResponse = new double[sampleSize];
+  private final double[] _mutateRecordRate = new double[sampleSize];
   private final long[] timestamp = new long[sampleSize];
   private volatile static QueryMetrics instance;
   private volatile int position;
@@ -66,11 +68,13 @@ public class QueryMetrics extends TimerTask {
 
       _queryExceptionRate[position] = queryExceptionCount;
 
-      _fetchRecordRate[position] = dataFetchCount;
+      _fetchRate[position] = dataFetchCount;
       _fetchResponse[position] = TimeUnit.NANOSECONDS.toMillis(dataFetchTime) / (double)
dataFetchCount;
+      _fetchRecordRate[position] = dataFetchRecordCount;
 
-      _mutateRecordRate[position] = dataMutateCount;
+      _mutateRate[position] = dataMutateCount;
       _mutateResponse[position] = TimeUnit.NANOSECONDS.toMillis(dataMutateTime) / (double)
dataMutateCount;
+      _mutateRecordRate[position] = dataMutateRecordCount;
 
       timestamp[position] = System.currentTimeMillis();
       position++;
@@ -98,12 +102,12 @@ public class QueryMetrics extends TimerTask {
     _dataMutateRecordCount.addAndGet(records);
   }
 
-  public void writeJson(PrintWriter out) {
+  public void writeGraph1Json(PrintWriter out) {
     synchronized (this) {
       out.print("{\"labels\":[");
       out.print("{\"name\":\"query\",\"style\":{\"stroke\":\"RoyalBlue\"}},");
       out.print("{\"name\":\"fetch\",\"style\":{\"stroke\":\"Black\"}},");
-      out.print("{\"name\":\"mutate\",\"style\":{\"stroke\":\"Yellow\"}},");
+      out.print("{\"name\":\"mutate\",\"style\":{\"stroke\":\"Orange\"}},");
       out.print("{\"name\":\"except\",\"style\":{\"stroke\":\"Red\"}}");
       out.print("],\"data\":[");
       int p = position;
@@ -113,8 +117,8 @@ public class QueryMetrics extends TimerTask {
           p = 0;
         }
         double query = _queryRate[p];
-        double fetch = _fetchRecordRate[p];
-        double mutate = _mutateRecordRate[p];
+        double fetch = _fetchRate[p];
+        double mutate = _mutateRate[p];
         double except = _queryExceptionRate[p];
         long t = timestamp[p];
         if (t == 0) {
@@ -139,4 +143,38 @@ public class QueryMetrics extends TimerTask {
       out.print("]}");
     }
   }
+  
+  public void writeGraph2Json(PrintWriter out) {
+    synchronized (this) {
+      out.print("{\"labels\":[");
+      out.print("{\"name\":\"fetchRecord\",\"style\":{\"stroke\":\"Black\"}},");
+      out.print("{\"name\":\"mutateRecord\",\"style\":{\"stroke\":\"Orange\"}}");
+      out.print("],\"data\":[");
+      int p = position;
+      boolean comma = false;
+      for (int i = 0; i < sampleSize; i++, p++) {
+        if (p >= sampleSize) {
+          p = 0;
+        }
+        double fetch = _fetchRecordRate[p];
+        double mutate = _mutateRecordRate[p];
+        long t = timestamp[p];
+        if (t == 0) {
+          continue;
+        }
+        if (comma) {
+          out.print(",");
+        }
+        out.print("{\"fetchRecord\":");
+        out.print(fetch);
+        out.print(",\"mutateRecord\":");
+        out.print(mutate);
+        out.print(",\"recordTime\":");
+        out.print(t);
+        out.print('}');
+        comma = true;
+      }
+      out.print("]}");
+    }
+  }
 }


Mime
View raw message