Selaa lähdekoodia

AMBARI-13192 Metrics data for last one month is missing many data points that should exist (dsen)

Dmytro Sen 10 vuotta sitten
vanhempi
commit
e159406c40

+ 2 - 2
ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/query/PhoenixTransactSQL.java

@@ -285,7 +285,7 @@ public class PhoenixTransactSQL {
         long endTime = condition.getEndTime() == null ? System.currentTimeMillis() : condition.getEndTime();
         long endTime = condition.getEndTime() == null ? System.currentTimeMillis() : condition.getEndTime();
         long startTime = condition.getStartTime() == null ? 0 : condition.getStartTime();
         long startTime = condition.getStartTime() == null ? 0 : condition.getStartTime();
         Long timeRange = endTime - startTime;
         Long timeRange = endTime - startTime;
-        if (timeRange > 7 * DAY) {
+        if (timeRange > 30 * DAY) {
           metricsTable = METRICS_AGGREGATE_DAILY_TABLE_NAME;
           metricsTable = METRICS_AGGREGATE_DAILY_TABLE_NAME;
           query = GET_METRIC_AGGREGATE_ONLY_SQL;
           query = GET_METRIC_AGGREGATE_ONLY_SQL;
           condition.setPrecision(Precision.DAYS);
           condition.setPrecision(Precision.DAYS);
@@ -529,7 +529,7 @@ public class PhoenixTransactSQL {
       long endTime = condition.getEndTime() == null ? System.currentTimeMillis() : condition.getEndTime();
       long endTime = condition.getEndTime() == null ? System.currentTimeMillis() : condition.getEndTime();
       long startTime = condition.getStartTime() == null ? 0 : condition.getStartTime();
       long startTime = condition.getStartTime() == null ? 0 : condition.getStartTime();
       Long timeRange = endTime - startTime;
       Long timeRange = endTime - startTime;
-      if (timeRange > 7 * DAY) {
+      if (timeRange > 30 * DAY) {
         metricsAggregateTable = METRICS_CLUSTER_AGGREGATE_DAILY_TABLE_NAME;
         metricsAggregateTable = METRICS_CLUSTER_AGGREGATE_DAILY_TABLE_NAME;
         queryStmt = GET_CLUSTER_AGGREGATE_TIME_SQL;
         queryStmt = GET_CLUSTER_AGGREGATE_TIME_SQL;
         condition.setPrecision(Precision.DAYS);
         condition.setPrecision(Precision.DAYS);

+ 4 - 4
ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TestPhoenixTransactSQL.java

@@ -191,7 +191,7 @@ public class TestPhoenixTransactSQL {
     verify(connection, preparedStatement);
     verify(connection, preparedStatement);
 
 
     // HOURS precision
     // HOURS precision
-    startTime = endTime-PhoenixTransactSQL.DAY*7/1000;
+    startTime = endTime-PhoenixTransactSQL.DAY*30/1000;
     condition = new DefaultCondition(
     condition = new DefaultCondition(
       Arrays.asList("cpu_user", "mem_free"), Collections.singletonList("h1"),
       Arrays.asList("cpu_user", "mem_free"), Collections.singletonList("h1"),
       "a1", "i1", startTime, endTime, null, null, false);
       "a1", "i1", startTime, endTime, null, null, false);
@@ -209,7 +209,7 @@ public class TestPhoenixTransactSQL {
     verify(connection, preparedStatement);
     verify(connection, preparedStatement);
 
 
     // DAYS precision
     // DAYS precision
-    startTime = endTime-PhoenixTransactSQL.DAY*7*2/1000;
+    startTime = endTime-PhoenixTransactSQL.DAY*30*2/1000;
     condition = new DefaultCondition(
     condition = new DefaultCondition(
       Arrays.asList("cpu_user", "mem_free"), Collections.singletonList("h1"),
       Arrays.asList("cpu_user", "mem_free"), Collections.singletonList("h1"),
       "a1", "i1", startTime, endTime, null, null, false);
       "a1", "i1", startTime, endTime, null, null, false);
@@ -320,7 +320,7 @@ public class TestPhoenixTransactSQL {
     verify(connection, preparedStatement);
     verify(connection, preparedStatement);
 
 
     // HOURS precision
     // HOURS precision
-    startTime = endTime-PhoenixTransactSQL.DAY*7/1000;
+    startTime = endTime-PhoenixTransactSQL.DAY*30/1000;
     condition = new DefaultCondition(
     condition = new DefaultCondition(
       Arrays.asList("cpu_user", "mem_free"), Collections.singletonList("h1"),
       Arrays.asList("cpu_user", "mem_free"), Collections.singletonList("h1"),
       "a1", "i1", startTime, endTime, null, null, false);
       "a1", "i1", startTime, endTime, null, null, false);
@@ -337,7 +337,7 @@ public class TestPhoenixTransactSQL {
     verify(connection, preparedStatement);
     verify(connection, preparedStatement);
 
 
     // DAYS precision
     // DAYS precision
-    startTime = endTime-PhoenixTransactSQL.DAY*7*2/1000;
+    startTime = endTime-PhoenixTransactSQL.DAY*30*2/1000;
     condition = new DefaultCondition(
     condition = new DefaultCondition(
       Arrays.asList("cpu_user", "mem_free"), Collections.singletonList("h1"),
       Arrays.asList("cpu_user", "mem_free"), Collections.singletonList("h1"),
       "a1", "i1", startTime, endTime, null, null, false);
       "a1", "i1", startTime, endTime, null, null, false);

+ 1 - 1
ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-log4j.xml

@@ -55,7 +55,7 @@ log4j.appender.file.File=${ams.log.dir}/${ams.log.file}
 log4j.appender.file.MaxFileSize=80MB
 log4j.appender.file.MaxFileSize=80MB
 log4j.appender.file.MaxBackupIndex=60
 log4j.appender.file.MaxBackupIndex=60
 log4j.appender.file.layout=org.apache.log4j.PatternLayout
 log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p [%t] %c{1}:%L - %m%n
+log4j.appender.file.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n
     </value>
     </value>
     <value-attributes>
     <value-attributes>
       <show-property-name>false</show-property-name>
       <show-property-name>false</show-property-name>