← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17084: Analytics, reduced logging

 

------------------------------------------------------------
revno: 17084
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-10-13 17:30:53 +0200
message:
  Analytics, reduced logging
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2014-10-07 12:16:23 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2014-10-13 15:30:53 +0000
@@ -747,7 +747,7 @@
 
         DataQueryGroups queryGroups = queryPlanner.planQuery( params, optimalQueries, tableName );
 
-        t.getSplitTime( "Planned query, got: " + queryGroups.getLargestGroupSize() + " for optimal: " + optimalQueries );
+        t.getSplitTime( "Planned analytics query, got: " + queryGroups.getLargestGroupSize() + " for optimal: " + optimalQueries );
 
         Map<String, Object> map = new HashMap<>();
 
@@ -779,11 +779,9 @@
                     throw new RuntimeException( "Error during execution of aggregation query task", ex );
                 }
             }
-
-            t.getSplitTime( "Got aggregated values for query group" );
         }
 
-        t.getTime( "Got aggregated values" );
+        t.getTime( "Got analytics values" );
 
         return map;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java	2014-10-07 12:16:23 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java	2014-10-13 15:30:53 +0000
@@ -76,7 +76,6 @@
 import org.hisp.dhis.system.util.MathUtils;
 import org.hisp.dhis.system.util.SqlHelper;
 import org.hisp.dhis.system.util.TextUtils;
-import org.hisp.dhis.util.Timer;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.BadSqlGrammarException;
 import org.springframework.jdbc.core.JdbcTemplate;
@@ -388,11 +387,9 @@
     {
         Map<String, Object> map = new HashMap<>();
         
-        Timer t = new Timer().start();
-        
         SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
         
-        t.getTime( "Analytics SQL: " + sql );
+        log.debug( "Analytics SQL: " + sql );
         
         while ( rowSet.next() )
         {

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java	2014-10-07 12:16:23 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java	2014-10-13 15:30:53 +0000
@@ -173,13 +173,19 @@
         // Data
         // ---------------------------------------------------------------------
 
+        Timer t = new Timer().start();
+
         List<EventQueryParams> queries = queryPlanner.planAggregateQuery( params );
 
+        t.getSplitTime( "Planned event query, got partitions: " + params.getPartitions() );
+
         for ( EventQueryParams query : queries )
         {
             analyticsManager.getAggregatedEventData( query, grid, maxLimit );
         }
         
+        t.getTime( "Got aggregated events" );
+        
         if ( maxLimit > 0 && grid.getHeight() > maxLimit )
         {
             throw new IllegalQueryException( "Number of rows produced by query is larger than the max limit: " + maxLimit );
@@ -272,7 +278,7 @@
 
         params = queryPlanner.planEventQuery( params );
 
-        t.getSplitTime( "Planned query, got partitions: " + params.getPartitions() );
+        t.getSplitTime( "Planned event query, got partitions: " + params.getPartitions() );
 
         int count = 0;
 
@@ -285,7 +291,7 @@
     
             analyticsManager.getEvents( params, grid, queryPlanner.getMaxLimit() );
     
-            t.getTime( "Queried events, got: " + grid.getHeight() );
+            t.getTime( "Got events " + grid.getHeight() );
         }
         
         // ---------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java	2014-10-07 12:16:23 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java	2014-10-13 15:30:53 +0000
@@ -54,7 +54,6 @@
 import org.hisp.dhis.common.QueryItem;
 import org.hisp.dhis.jdbc.StatementBuilder;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.util.Timer;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.BadSqlGrammarException;
 import org.springframework.jdbc.core.JdbcTemplate;
@@ -147,11 +146,9 @@
     
     private void getAggregatedEventData( Grid grid, EventQueryParams params, String sql )
     {
-        Timer t = new Timer().start();
-                
         SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
 
-        t.getTime( "Analytics event aggregate SQL: " + sql );
+        log.debug( "Analytics event aggregate SQL: " + sql );
         
         while ( rowSet.next() )
         {
@@ -246,13 +243,11 @@
 
     private void getEvents( Grid grid, EventQueryParams params, String sql )
     {
-        Timer t = new Timer().start();
-
         int rowLength = grid.getHeaders().size();
 
         SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
 
-        t.getTime( "Analytics event query SQL: " + sql );
+        log.debug( "Analytics event query SQL: " + sql );
         
         while ( rowSet.next() )
         {
@@ -296,11 +291,9 @@
     
     private int getEventCount( String sql )
     {
-        Timer t = new Timer().start();
-        
         int count = jdbcTemplate.queryForObject( sql, Integer.class );
 
-        t.getTime( "Analytics event count SQL: " + sql );
+        log.debug( "Analytics event count SQL: " + sql );
         
         return count;
     }