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 74552fc28..7fe2bf384 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 { *
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} - *
The average young generation GC average count formula is "COUNT / TIMES". + *
The young generation GC count *
The average young generation GC average duration formula is "DURATION / TIMES". *
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 { *
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} - *
The average young generation GC average count formula is "COUNT / TIMES". - *
The average young generation GC average duration formula is "DURATION / TIMES". + *
The old generation GC count + *
The average old generation GC average duration formula is "DURATION / TIMES". *
Every element in return list must match DurationPoint list, which also means that, * the two list must be in same size, and index match. *
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 71c08805c..251ec4b42 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 6975adb1d..b139f645f 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 84950d037..521ef999f 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)); }