From db8b931cbbad8e20efa43058cc35f5b4b460ccec Mon Sep 17 00:00:00 2001 From: lican <295198088@qq.com> Date: Sun, 6 May 2018 22:05:26 +0800 Subject: [PATCH] Fix If traceId not exists result will return all traces (#1178) --- .../apm/collector/ui/service/SegmentTopService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/SegmentTopService.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/SegmentTopService.java index b9f362f3e..55a356f28 100644 --- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/SegmentTopService.java +++ b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/SegmentTopService.java @@ -20,6 +20,7 @@ package org.apache.skywalking.apm.collector.ui.service; import java.util.List; import org.apache.skywalking.apm.collector.core.module.ModuleManager; +import org.apache.skywalking.apm.collector.core.util.CollectionUtils; import org.apache.skywalking.apm.collector.core.util.StringUtils; import org.apache.skywalking.apm.collector.storage.StorageModule; import org.apache.skywalking.apm.collector.storage.dao.ui.IGlobalTraceUIDAO; @@ -54,6 +55,9 @@ public class SegmentTopService { TraceBrief traceBrief; if (StringUtils.isNotEmpty(traceId)) { List segmentIds = globalTraceUIDAO.getSegmentIds(traceId); + if (CollectionUtils.isEmpty(segmentIds)) { + return new TraceBrief(); + } traceBrief = segmentDurationUIDAO.loadTop(startSecondTimeBucket, endSecondTimeBucket, minDuration, maxDuration, operationName, applicationId, limit, from, segmentIds.toArray(new String[0])); } else { traceBrief = segmentDurationUIDAO.loadTop(startSecondTimeBucket, endSecondTimeBucket, minDuration, maxDuration, operationName, applicationId, limit, from); -- GitLab