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/08 15:16:45 UTC

svn commit: r1616743 - 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: Fri Aug  8 13:16:44 2014
New Revision: 1616743

URL: http://svn.apache.org/r1616743
Log:
more data in jvm report

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=1616743&r1=1616742&r2=1616743&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 Fri Aug  8 13:16:44 2014
@@ -16,8 +16,10 @@
  */
 package org.apache.sirona.reporting.web.jvm;
 
+import org.apache.sirona.gauges.jvm.ActiveThreadGauge;
 import org.apache.sirona.gauges.jvm.CPUGauge;
 import org.apache.sirona.gauges.jvm.UsedMemoryGauge;
+import org.apache.sirona.gauges.jvm.UsedNonHeapMemoryGauge;
 import org.apache.sirona.reporting.web.Graph;
 import org.apache.sirona.repositories.Repository;
 
@@ -56,4 +58,26 @@ public class JvmReports
 
     }
 
+    @GET
+    @Path( "/nonheapmemory/{start}/{end}" )
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+    public Graph nonHeapmemory( @PathParam( "start" ) final long start, @PathParam( "end" ) final long end )
+    {
+        final SortedMap<Long, Double> gaugeValues =
+            Repository.INSTANCE.getGaugeValues( start, end, UsedNonHeapMemoryGauge.USED_NONHEAPMEMORY );
+        return new Graph( "Used Non Heap Memory", Graph.DEFAULT_COLOR, gaugeValues );
+
+    }
+
+    @GET
+    @Path( "/activethreads/{start}/{end}" )
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+    public Graph activeThreads( @PathParam( "start" ) final long start, @PathParam( "end" ) final long end )
+    {
+        final SortedMap<Long, Double> gaugeValues =
+            Repository.INSTANCE.getGaugeValues( start, end, ActiveThreadGauge.ACTIVE_THREAD );
+        return new Graph( "Active Thread Count", 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=1616743&r1=1616742&r2=1616743&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 Fri Aug  8 13:16:44 2014
@@ -30,8 +30,8 @@ define(['angular','services','morris'], 
 
   var jvmControllers = angular.module('jvmControllers', ['sironaJvmServices']);
 
-  jvmControllers.controller( 'JvmHomeCtrl', ['$scope','jvmCpu','jvmMemory',
-    function ( $scope,jvmCpu,jvmMemory ){
+  jvmControllers.controller( 'JvmHomeCtrl', ['$scope','jvmCpu','jvmMemory','nonHeapMemory','activeThreads',
+    function ( $scope,jvmCpu,jvmMemory,nonHeapMemory,activeThreads ){
 
       console.log("JvmHomeCtrl");
 
@@ -74,25 +74,43 @@ define(['angular','services','morris'], 
 
       });
 
+      nonHeapMemory.query({start:yesterday.getTime(),end:now.getTime()} ).$promise.then(function(memoryResults){
+        var morrisDatas=toMorrisFormat(memoryResults.data);
+        Morris.Line({
+                      element: 'nonheapmemory',
+                      data: morrisDatas,
+                      xkey: 'x',
+                      ykeys: 'y',
+                      labels: [memoryResults.label],
+                      xLabelFormat:function(ret){
+                        return new Date(morrisDatas[ret.x].x).toString();
+                      },
+                      parseTime: false,
+                      hideHover: 'auto'
+                    });
+
+      });
+
+      activeThreads.query({start:yesterday.getTime(),end:now.getTime()} ).$promise.then(function(results){
+        var morrisDatas=toMorrisFormat(results.data);
+        Morris.Line({
+                      element: 'activethreads',
+                      data: morrisDatas,
+                      xkey: 'x',
+                      ykeys: 'y',
+                      labels: [results.label],
+                      xLabelFormat:function(ret){
+                        return new Date(morrisDatas[ret.x].x).toString();
+                      },
+                      parseTime: false,
+                      hideHover: 'auto'
+                    });
+
+      });
 
   }]);
 
-  /*
-   format
-   {"label":"CPU Usage","color":"#317eac"
-   ,"data":{"1407322921555":3.71142578125,"1407322981555":2.63671875,"1407323041555":1.97216796875}}
-
-   to morris format
-   [
-   { y: '2006', a: 100 },
-   { y: '2007', a: 75 },
-   { y: '2008', a: 50 },
-   { y: '2009', a: 75 },
-   { y: '2010', a: 50 },
-   { y: '2011', a: 75 },
-   { y: '2012', a: 100 }
-   ]
-   */
+
   var toMorrisFormat=function(reportResult){
     if (reportResult==null){
       console.log("reportResult==null");

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=1616743&r1=1616742&r2=1616743&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 Fri Aug  8 13:16:44 2014
@@ -34,4 +34,18 @@ define(['angular','angular-resource'], f
                        {query: {method:'GET', params:{}}});
     }]);
 
+  sironaServices.factory('nonHeapMemory', ['$resource',
+    function($resource){
+      return $resource('restServices/sironaServices/jvmreports/nonheapmemory/:start/:end',
+                       {start:'@start',end:'@end'},
+                       {query: {method:'GET', params:{}}});
+    }]);
+
+  sironaServices.factory('activeThreads', ['$resource',
+    function($resource){
+      return $resource('restServices/sironaServices/jvmreports/activethreads/: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=1616743&r1=1616742&r2=1616743&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 Fri Aug  8 13:16:44 2014
@@ -21,4 +21,10 @@
   <div class="col-lg-3">
     <div id="memory"></div>
   </div>
+  <div class="col-lg-3">
+    <div id="nonheapmemory"></div>
+  </div>
+  <div class="col-lg-3">
+    <div id="activethreads"></div>
+  </div>
 </div>
\ No newline at end of file