You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by pe...@apache.org on 2018/07/04 03:23:47 UTC

[incubator-skywalking] branch master updated: #1425 (#1426)

This is an automated email from the ASF dual-hosted git repository.

pengys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new 5941e72  #1425 (#1426)
5941e72 is described below

commit 5941e72f8184354f5558cf7cb90e0efa7d45dc82
Author: 彭勇升 pengys <80...@qq.com>
AuthorDate: Wed Jul 4 11:23:43 2018 +0800

    #1425 (#1426)
    
    Fixed the bug of the result of GC count in query of GC trend service always 0.
---
 .../collector/storage/dao/ui/IGCMetricUIDAO.java   |  6 ++---
 .../storage/es/dao/ui/GCMetricEsUIDAO.java         |  2 +-
 .../storage/h2/dao/ui/GCMetricH2UIDAO.java         |  2 +-
 .../dao/ui/GCMetricShardingjdbcUIDAO.java          | 28 ++++++++--------------
 4 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IGCMetricUIDAO.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IGCMetricUIDAO.java
index 74552fc..7fe2bf3 100644
--- a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IGCMetricUIDAO.java
+++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IGCMetricUIDAO.java
@@ -40,7 +40,7 @@ public interface IGCMetricUIDAO extends DAO {
      * <p>SQL as: select COUNT, TIMES, DURATION from GC_METRIC where ID in (durationPoints), rule of
      * ID generation is "${durationPoint}_${instanceId}_${gcPhrase}",
      * {@link org.apache.skywalking.apm.network.proto.GCPhrase#NEW_VALUE}
-     * <p>The average young generation GC average count formula is "COUNT / TIMES".
+     * <p>The young generation GC count
      * <p>The average young generation GC average duration formula is "DURATION / TIMES".
      * <p>Every element in return list must match DurationPoint list, which also means that,
      * the two list must be in same size, and index match.
@@ -64,8 +64,8 @@ public interface IGCMetricUIDAO extends DAO {
      * <p>SQL as: select COUNT, TIMES, DURATION from GC_METRIC where ID in (durationPoints), rule of
      * ID generation is "${durationPoint}_${instanceId}_${gcPhrase}",
      * {@link org.apache.skywalking.apm.network.proto.GCPhrase#OLD_VALUE}
-     * <p>The average young generation GC average count formula is "COUNT / TIMES".
-     * <p>The average young generation GC average duration formula is "DURATION / TIMES".
+     * <p>The old generation GC count
+     * <p>The average old generation GC average duration formula is "DURATION / TIMES".
      * <p>Every element in return list must match DurationPoint list, which also means that,
      * the two list must be in same size, and index match.
      * <p>If some element of the return list can't be found, the implementor must set 0 as
diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/GCMetricEsUIDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/GCMetricEsUIDAO.java
index 71c0880..251ec4b 100644
--- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/GCMetricEsUIDAO.java
+++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/GCMetricEsUIDAO.java
@@ -66,7 +66,7 @@ public class GCMetricEsUIDAO extends EsDAO implements IGCMetricUIDAO {
                 long count = ((Number)itemResponse.getResponse().getSource().get(GCMetricTable.COUNT.getName())).longValue();
                 long duration = ((Number)itemResponse.getResponse().getSource().get(GCMetricTable.DURATION.getName())).longValue();
                 long times = ((Number)itemResponse.getResponse().getSource().get(GCMetricTable.TIMES.getName())).intValue();
-                gcTrends.add(new Trend((int)(count / times), (int)(duration / times)));
+                gcTrends.add(new Trend((int)count, (int)(duration / times)));
             } else {
                 gcTrends.add(new Trend(0, 0));
             }
diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/GCMetricH2UIDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/GCMetricH2UIDAO.java
index 6975adb..b139f64 100644
--- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/GCMetricH2UIDAO.java
+++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/GCMetricH2UIDAO.java
@@ -65,7 +65,7 @@ public class GCMetricH2UIDAO extends H2DAO implements IGCMetricUIDAO {
                     long count = rs.getLong(GCMetricTable.COUNT.getName());
                     long duration = rs.getLong(GCMetricTable.DURATION.getName());
                     long times = rs.getLong(GCMetricTable.TIMES.getName());
-                    gcTrends.add(new Trend((int)(count / times), (int)(duration / times)));
+                    gcTrends.add(new Trend((int)count, (int)(duration / times)));
                 } else {
                     gcTrends.add(new Trend(0, 0));
                 }
diff --git a/apm-collector/apm-collector-storage/collector-storage-shardingjdbc-provider/src/main/java/org/apache/skywalking/apm/collector/storage/shardingjdbc/dao/ui/GCMetricShardingjdbcUIDAO.java b/apm-collector/apm-collector-storage/collector-storage-shardingjdbc-provider/src/main/java/org/apache/skywalking/apm/collector/storage/shardingjdbc/dao/ui/GCMetricShardingjdbcUIDAO.java
index 84950d0..521ef99 100644
--- a/apm-collector/apm-collector-storage/collector-storage-shardingjdbc-provider/src/main/java/org/apache/skywalking/apm/collector/storage/shardingjdbc/dao/ui/GCMetricShardingjdbcUIDAO.java
+++ b/apm-collector/apm-collector-storage/collector-storage-shardingjdbc-provider/src/main/java/org/apache/skywalking/apm/collector/storage/shardingjdbc/dao/ui/GCMetricShardingjdbcUIDAO.java
@@ -18,26 +18,18 @@
 
 package org.apache.skywalking.apm.collector.storage.shardingjdbc.dao.ui;
 
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.skywalking.apm.collector.client.shardingjdbc.ShardingjdbcClient;
-import org.apache.skywalking.apm.collector.client.shardingjdbc.ShardingjdbcClientException;
+import java.sql.*;
+import java.util.*;
+import org.apache.skywalking.apm.collector.client.shardingjdbc.*;
 import org.apache.skywalking.apm.collector.core.util.Const;
 import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IGCMetricUIDAO;
 import org.apache.skywalking.apm.collector.storage.shardingjdbc.base.dao.ShardingjdbcDAO;
 import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetricTable;
 import org.apache.skywalking.apm.collector.storage.ui.common.Step;
-import org.apache.skywalking.apm.collector.storage.utils.DurationPoint;
-import org.apache.skywalking.apm.collector.storage.utils.TimePyramidTableNameBuilder;
+import org.apache.skywalking.apm.collector.storage.utils.*;
 import org.apache.skywalking.apm.network.proto.GCPhrase;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.slf4j.*;
 
 /**
  * @author linjiaqi
@@ -69,15 +61,15 @@ public class GCMetricShardingjdbcUIDAO extends ShardingjdbcDAO implements IGCMet
         durationPoints.forEach(durationPoint -> {
             String id = durationPoint.getPoint() + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + gcPhrase;
             try (
-                    ResultSet rs = client.executeQuery(sql, new String[] {id});
-                    Statement statement = rs.getStatement();
-                    Connection conn = statement.getConnection();
-                ) {
+                ResultSet rs = client.executeQuery(sql, new String[] {id});
+                Statement statement = rs.getStatement();
+                Connection conn = statement.getConnection();
+            ) {
                 if (rs.next()) {
                     long count = rs.getLong(GCMetricTable.COUNT.getName());
                     long duration = rs.getLong(GCMetricTable.DURATION.getName());
                     long times = rs.getLong(GCMetricTable.TIMES.getName());
-                    gcTrends.add(new Trend((int)(count / times), (int)(duration / times)));
+                    gcTrends.add(new Trend((int)count, (int)(duration / times)));
                 } else {
                     gcTrends.add(new Trend(0, 0));
                 }