You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@skywalking.apache.org by GitBox <gi...@apache.org> on 2018/02/28 14:06:45 UTC
[GitHub] peng-yongsheng closed pull request #850: "getServerResponseTimeTrend","getServerTPSTrend","getCPUTrend","getGCTrend","getMemoryTrend"
peng-yongsheng closed pull request #850: "getServerResponseTimeTrend","getServerTPSTrend","getCPUTrend","getGCTrend","getMemoryTrend"
URL: https://github.com/apache/incubator-skywalking/pull/850
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ServerQuery.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ServerQuery.java
index b269703ad..cae9a389f 100644
--- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ServerQuery.java
+++ b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ServerQuery.java
@@ -65,32 +65,32 @@ private ServerService getServerService() {
}
public ResponseTimeTrend getServerResponseTimeTrend(int serverId, Duration duration) throws ParseException {
- long start = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart());
- long end = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd());
- return getServerService().getServerResponseTimeTrend(serverId, duration.getStep(), start, end);
+ long startTimeBucket = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart());
+ long endTimeBucket = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd());
+ return getServerService().getServerResponseTimeTrend(serverId, duration.getStep(), startTimeBucket, endTimeBucket);
}
public ThroughputTrend getServerTPSTrend(int serverId, Duration duration) throws ParseException {
- long start = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart());
- long end = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd());
- return getServerService().getServerTPSTrend(serverId, duration.getStep(), start, end);
+ long startTimeBucket = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart());
+ long endTimeBucket = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd());
+ return getServerService().getServerTPSTrend(serverId, duration.getStep(), startTimeBucket, endTimeBucket);
}
public CPUTrend getCPUTrend(int serverId, Duration duration) throws ParseException {
- long start = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart());
- long end = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd());
- return getServerService().getCPUTrend(serverId, duration.getStep(), start, end);
+ long startTimeBucket = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart());
+ long endTimeBucket = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd());
+ return getServerService().getCPUTrend(serverId, duration.getStep(), startTimeBucket, endTimeBucket);
}
public GCTrend getGCTrend(int serverId, Duration duration) throws ParseException {
- long start = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart());
- long end = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd());
- return getServerService().getGCTrend(serverId, duration.getStep(), start, end);
+ long startTimeBucket = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart());
+ long endTimeBucket = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd());
+ return getServerService().getGCTrend(serverId, duration.getStep(), startTimeBucket, endTimeBucket);
}
public MemoryTrend getMemoryTrend(int serverId, Duration duration) throws ParseException {
- long start = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart());
- long end = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd());
- return getServerService().getMemoryTrend(serverId, duration.getStep(), start, end);
+ long startTimeBucket = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart());
+ long endTimeBucket = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd());
+ return getServerService().getMemoryTrend(serverId, duration.getStep(), startTimeBucket, endTimeBucket);
}
}
diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ServerService.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ServerService.java
index 41620c751..f3e7d85cf 100644
--- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ServerService.java
+++ b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ServerService.java
@@ -92,10 +92,10 @@ public ServerService(ModuleManager moduleManager) {
return serverInfos;
}
- public ResponseTimeTrend getServerResponseTimeTrend(int instanceId, Step step, long start,
- long end) throws ParseException {
+ public ResponseTimeTrend getServerResponseTimeTrend(int instanceId, Step step, long startTimeBucket,
+ long endTimeBucket) throws ParseException {
ResponseTimeTrend responseTimeTrend = new ResponseTimeTrend();
- List<DurationPoint> durationPoints = DurationUtils.INSTANCE.getDurationPoints(step, start, end);
+ List<DurationPoint> durationPoints = DurationUtils.INSTANCE.getDurationPoints(step, startTimeBucket, endTimeBucket);
List<Integer> trends = instanceMetricUIDAO.getResponseTimeTrend(instanceId, step, durationPoints);
responseTimeTrend.setTrendList(trends);
return responseTimeTrend;
@@ -117,25 +117,28 @@ public ResponseTimeTrend getServerResponseTimeTrend(int instanceId, Step step, l
return serverThroughput;
}
- public ThroughputTrend getServerTPSTrend(int instanceId, Step step, long start, long end) throws ParseException {
+ public ThroughputTrend getServerTPSTrend(int instanceId, Step step, long startTimeBucket,
+ long endTimeBucket) throws ParseException {
ThroughputTrend throughputTrend = new ThroughputTrend();
- List<DurationPoint> durationPoints = DurationUtils.INSTANCE.getDurationPoints(step, start, end);
+ List<DurationPoint> durationPoints = DurationUtils.INSTANCE.getDurationPoints(step, startTimeBucket, endTimeBucket);
List<Integer> trends = instanceMetricUIDAO.getServerTPSTrend(instanceId, step, durationPoints);
throughputTrend.setTrendList(trends);
return throughputTrend;
}
- public CPUTrend getCPUTrend(int instanceId, Step step, long start, long end) throws ParseException {
+ public CPUTrend getCPUTrend(int instanceId, Step step, long startTimeBucket,
+ long endTimeBucket) throws ParseException {
CPUTrend cpuTrend = new CPUTrend();
- List<DurationPoint> durationPoints = DurationUtils.INSTANCE.getDurationPoints(step, start, end);
+ List<DurationPoint> durationPoints = DurationUtils.INSTANCE.getDurationPoints(step, startTimeBucket, endTimeBucket);
List<Integer> trends = cpuMetricUIDAO.getCPUTrend(instanceId, step, durationPoints);
cpuTrend.setCost(trends);
return cpuTrend;
}
- public GCTrend getGCTrend(int instanceId, Step step, long start, long end) throws ParseException {
+ public GCTrend getGCTrend(int instanceId, Step step, long startTimeBucket,
+ long endTimeBucket) throws ParseException {
GCTrend gcTrend = new GCTrend();
- List<DurationPoint> durationPoints = DurationUtils.INSTANCE.getDurationPoints(step, start, end);
+ List<DurationPoint> durationPoints = DurationUtils.INSTANCE.getDurationPoints(step, startTimeBucket, endTimeBucket);
List<Integer> youngGCTrend = gcMetricUIDAO.getYoungGCTrend(instanceId, step, durationPoints);
gcTrend.setYoungGC(youngGCTrend);
List<Integer> oldGCTrend = gcMetricUIDAO.getOldGCTrend(instanceId, step, durationPoints);
@@ -143,9 +146,9 @@ public GCTrend getGCTrend(int instanceId, Step step, long start, long end) throw
return gcTrend;
}
- public MemoryTrend getMemoryTrend(int instanceId, Step step, long start, long end) throws ParseException {
+ public MemoryTrend getMemoryTrend(int instanceId, Step step, long startTimeBucket, long endTimeBucket) throws ParseException {
MemoryTrend memoryTrend = new MemoryTrend();
- List<DurationPoint> durationPoints = DurationUtils.INSTANCE.getDurationPoints(step, start, end);
+ List<DurationPoint> durationPoints = DurationUtils.INSTANCE.getDurationPoints(step, startTimeBucket, endTimeBucket);
IMemoryMetricUIDAO.Trend heapMemoryTrend = memoryMetricUIDAO.getHeapMemoryTrend(instanceId, step, durationPoints);
memoryTrend.setHeap(heapMemoryTrend.getMetrics());
memoryTrend.setMaxHeap(heapMemoryTrend.getMaxMetrics());
diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/utils/DurationUtils.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/utils/DurationUtils.java
index d88a23657..52e5976dd 100644
--- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/utils/DurationUtils.java
+++ b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/utils/DurationUtils.java
@@ -139,11 +139,11 @@ public DateTime parseToDateTime(Step step, long time) throws ParseException {
return dateTime;
}
- public List<DurationPoint> getDurationPoints(Step step, long start, long end) throws ParseException {
- DateTime dateTime = parseToDateTime(step, start);
+ public List<DurationPoint> getDurationPoints(Step step, long startTimeBucket, long endTimeBucket) throws ParseException {
+ DateTime dateTime = parseToDateTime(step, startTimeBucket);
List<DurationPoint> durations = new LinkedList<>();
- durations.add(new DurationPoint(start, secondsBetween(step, dateTime)));
+ durations.add(new DurationPoint(startTimeBucket, secondsBetween(step, dateTime)));
int i = 0;
do {
@@ -176,10 +176,10 @@ public DateTime parseToDateTime(Step step, long time) throws ParseException {
}
i++;
if (i > 500) {
- throw new UnexpectedException("Duration data error, step: " + step.name() + ", start: " + start + ", end: " + end);
+ throw new UnexpectedException("Duration data error, step: " + step.name() + ", start: " + startTimeBucket + ", end: " + endTimeBucket);
}
}
- while (end != durations.get(durations.size() - 1).getPoint());
+ while (endTimeBucket != durations.get(durations.size() - 1).getPoint());
return durations;
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services