You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sirona.apache.org by ol...@apache.org on 2014/08/06 14:27:57 UTC

svn commit: r1616206 - in /incubator/sirona/trunk/server/reporting: reporting-api/src/main/java/org/apache/sirona/reporting/web/jvm/ reporting-ui/src/main/webapp/js/app/controllers/ reporting-ui/src/main/webapp/js/app/services/ reporting-ui/src/main/we...

Author: olamy
Date: Wed Aug  6 12:27:56 2014
New Revision: 1616206

URL: http://svn.apache.org/r1616206
Log:
add memory

Modified:
    incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/jvm/JvmReports.java
    incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers.js
    incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/services/services.js
    incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/jvm.html

Modified: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/jvm/JvmReports.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/jvm/JvmReports.java?rev=1616206&r1=1616205&r2=1616206&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/jvm/JvmReports.java (original)
+++ incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/jvm/JvmReports.java Wed Aug  6 12:27:56 2014
@@ -17,6 +17,7 @@
 package org.apache.sirona.reporting.web.jvm;
 
 import org.apache.sirona.gauges.jvm.CPUGauge;
+import org.apache.sirona.gauges.jvm.UsedMemoryGauge;
 import org.apache.sirona.reporting.web.Graph;
 import org.apache.sirona.repositories.Repository;
 
@@ -44,4 +45,15 @@ public class JvmReports
 
     }
 
+    @GET
+    @Path( "/memory/{start}/{end}" )
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+    public Graph memory( @PathParam( "start" ) final long start, @PathParam( "end" ) final long end )
+    {
+        final SortedMap<Long, Double> gaugeValues =
+            Repository.INSTANCE.getGaugeValues( start, end, UsedMemoryGauge.USED_MEMORY );
+        return new Graph( "Used Memory", Graph.DEFAULT_COLOR, gaugeValues );
+
+    }
+
 }

Modified: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers.js
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers.js?rev=1616206&r1=1616205&r2=1616206&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers.js (original)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/controllers/controllers.js Wed Aug  6 12:27:56 2014
@@ -30,30 +30,49 @@ define(['angular','services','morris'], 
 
   var jvmControllers = angular.module('jvmControllers', ['sironaJvmServices']);
 
-  jvmControllers.controller( 'JvmHomeCtrl', ['$scope','jvmCpu', function ( $scope,jvmCpu ){
-    console.log("JvmHomeCtrl");
+  jvmControllers.controller( 'JvmHomeCtrl', ['$scope','jvmCpu','jvmMemory',
+    function ( $scope,jvmCpu,jvmMemory ){
 
-    var yesterday = new Date();
-    yesterday.setTime(yesterday.getTime() - dayDuration);
+      console.log("JvmHomeCtrl");
 
-    var now = new Date();
+      var yesterday = new Date();
+      yesterday.setTime(yesterday.getTime() - dayDuration);
 
-    jvmCpu.query({start:yesterday.getTime(),end:now.getTime()} ).$promise.then(function(cpuResults){
-      var morrisDatas=toMorrisFormat(cpuResults.data);
-      Morris.Line({
-                    element: 'cpu',
-                    data: morrisDatas,
-                    xkey: 'x',
-                    ykeys: 'y',
-                    labels: [cpuResults.label],
-                    xLabelFormat:function(ret){
-                      return new Date(morrisDatas[ret.x].x).toString();
-                    },
-                    parseTime: false,
-                    hideHover: 'auto'
-                  });
+      var now = new Date();
+
+      jvmCpu.query({start:yesterday.getTime(),end:now.getTime()} ).$promise.then(function(cpuResults){
+        var morrisDatas=toMorrisFormat(cpuResults.data);
+        Morris.Line({
+                      element: 'cpu',
+                      data: morrisDatas,
+                      xkey: 'x',
+                      ykeys: 'y',
+                      labels: [cpuResults.label],
+                      xLabelFormat:function(ret){
+                        return new Date(morrisDatas[ret.x].x).toString();
+                      },
+                      parseTime: false,
+                      hideHover: 'auto'
+                    });
+
+      });
+
+      jvmMemory.query({start:yesterday.getTime(),end:now.getTime()} ).$promise.then(function(memoryResults){
+        var morrisDatas=toMorrisFormat(memoryResults.data);
+        Morris.Line({
+                      element: 'memory',
+                      data: morrisDatas,
+                      xkey: 'x',
+                      ykeys: 'y',
+                      labels: [memoryResults.label],
+                      xLabelFormat:function(ret){
+                        return new Date(morrisDatas[ret.x].x).toString();
+                      },
+                      parseTime: false,
+                      hideHover: 'auto'
+                    });
 
-    });
+      });
 
 
   }]);
@@ -84,9 +103,6 @@ define(['angular','services','morris'], 
       this.push({x:value,y: key});
     }, values);
 
-    console.log("size:"+values.length+':'+values[0].x+","+values[0].y);
-    console.log("size:"+values.length+':'+values[1].x+","+values[1].y);
-    console.log("size:"+values.length+':'+values[10].x+","+values[10].y);
 
     return values;
   }

Modified: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/services/services.js
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/services/services.js?rev=1616206&r1=1616205&r2=1616206&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/services/services.js (original)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/js/app/services/services.js Wed Aug  6 12:27:56 2014
@@ -27,4 +27,11 @@ define(['angular','angular-resource'], f
                        {query: {method:'GET', params:{}}});
     }]);
 
+  sironaServices.factory('jvmMemory', ['$resource',
+    function($resource){
+      return $resource('restServices/sironaServices/jvmreports/memory/:start/:end',
+                       {start:'@start',end:'@end'},
+                       {query: {method:'GET', params:{}}});
+    }]);
+
 });
\ No newline at end of file

Modified: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/jvm.html
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/jvm.html?rev=1616206&r1=1616205&r2=1616206&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/jvm.html (original)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/partials/jvm.html Wed Aug  6 12:27:56 2014
@@ -18,4 +18,7 @@
   <div class="col-lg-3">
     <div id="cpu"></div>
   </div>
+  <div class="col-lg-3">
+    <div id="memory"></div>
+  </div>
 </div>
\ No newline at end of file