wu-sheng closed pull request #1255: Fixing #1231. Adding order and status to 
trace query.
URL: https://github.com/apache/incubator-skywalking/pull/1255
 
 
   

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-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/ISegmentDurationUIDAO.java
 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/ISegmentDurationUIDAO.java
index 46e82826a..97f93f3ff 100644
--- 
a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/ISegmentDurationUIDAO.java
+++ 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/ISegmentDurationUIDAO.java
@@ -19,7 +19,9 @@
 package org.apache.skywalking.apm.collector.storage.dao.ui;
 
 import org.apache.skywalking.apm.collector.storage.base.dao.DAO;
+import org.apache.skywalking.apm.collector.storage.ui.trace.QueryOrder;
 import org.apache.skywalking.apm.collector.storage.ui.trace.TraceBrief;
+import org.apache.skywalking.apm.collector.storage.ui.trace.TraceState;
 
 /**
  * Interface to be implemented for execute database query operation
@@ -55,5 +57,5 @@
      * @return not nullable result list
      */
     TraceBrief loadTop(long startSecondTimeBucket, long endSecondTimeBucket, 
long minDuration, long maxDuration,
-        String operationName, int applicationId, int limit, int from, 
String... segmentIds);
+                       String operationName, int applicationId, int limit, int 
from, TraceState traceState, QueryOrder queryOrder, String... segmentIds);
 }
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/QueryOrder.java
 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/QueryOrder.java
new file mode 100644
index 000000000..2f0a5f9d1
--- /dev/null
+++ 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/QueryOrder.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.storage.ui.trace;
+
+public enum QueryOrder {
+    BY_START_TIME,
+    BY_DURATION
+}
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/TraceQueryCondition.java
 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/TraceQueryCondition.java
index 86bea1abe..103d70043 100644
--- 
a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/TraceQueryCondition.java
+++ 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/TraceQueryCondition.java
@@ -31,6 +31,25 @@
     private Duration queryDuration;
     private int minTraceDuration;
     private int maxTraceDuration;
+    private TraceState traceState;
+    private  QueryOrder queryOrder;
+
+    public TraceState getTraceState() {
+        return traceState;
+    }
+
+    public void setTraceState(TraceState traceState) {
+        this.traceState = traceState;
+    }
+
+    public QueryOrder getQueryOrder() {
+        return queryOrder;
+    }
+
+    public void setQueryOrder(QueryOrder queryOrder) {
+        this.queryOrder = queryOrder;
+    }
+
     private Pagination paging;
 
     public int getApplicationId() {
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/TraceState.java
 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/TraceState.java
new file mode 100644
index 000000000..71b52dd14
--- /dev/null
+++ 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/TraceState.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.storage.ui.trace;
+
+public enum TraceState {
+    ALL,
+    SUCCESS,
+    ERROR
+}
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/SegmentDurationEsUIDAO.java
 
b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/SegmentDurationEsUIDAO.java
index 1a1fc9292..40374a2ac 100644
--- 
a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/SegmentDurationEsUIDAO.java
+++ 
b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/SegmentDurationEsUIDAO.java
@@ -27,7 +27,9 @@
 import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO;
 import 
org.apache.skywalking.apm.collector.storage.table.segment.SegmentDurationTable;
 import org.apache.skywalking.apm.collector.storage.ui.trace.BasicTrace;
+import org.apache.skywalking.apm.collector.storage.ui.trace.QueryOrder;
 import org.apache.skywalking.apm.collector.storage.ui.trace.TraceBrief;
+import org.apache.skywalking.apm.collector.storage.ui.trace.TraceState;
 import org.elasticsearch.action.search.SearchRequestBuilder;
 import org.elasticsearch.action.search.SearchResponse;
 import org.elasticsearch.action.search.SearchType;
@@ -49,7 +51,7 @@ public SegmentDurationEsUIDAO(ElasticSearchClient client) {
 
     @Override
     public TraceBrief loadTop(long startSecondTimeBucket, long 
endSecondTimeBucket, long minDuration, long maxDuration,
-        String operationName, int applicationId, int limit, int from, 
String... segmentIds) {
+                              String operationName, int applicationId, int 
limit, int from, TraceState traceState, QueryOrder queryOrder, String... 
segmentIds) {
         SearchRequestBuilder searchRequestBuilder = 
getClient().prepareSearch(SegmentDurationTable.TABLE);
         searchRequestBuilder.setTypes(SegmentDurationTable.TABLE_TYPE);
         searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH);
@@ -81,8 +83,22 @@ public TraceBrief loadTop(long startSecondTimeBucket, long 
endSecondTimeBucket,
         if (applicationId != 0) {
             
boolQueryBuilder.must().add(QueryBuilders.termQuery(SegmentDurationTable.APPLICATION_ID.getName(),
 applicationId));
         }
-
-        
searchRequestBuilder.addSort(SegmentDurationTable.START_TIME.getName(), 
SortOrder.DESC);
+        switch (traceState) {
+            case ERROR:
+                
mustQueryList.add(QueryBuilders.matchQuery(SegmentDurationTable.IS_ERROR.getName(),
 BooleanUtils.TRUE));
+                break;
+            case SUCCESS:
+                
mustQueryList.add(QueryBuilders.matchQuery(SegmentDurationTable.IS_ERROR.getName(),
 BooleanUtils.FALSE));
+                break;
+        }
+        switch (queryOrder) {
+            case BY_START_TIME:
+                
searchRequestBuilder.addSort(SegmentDurationTable.START_TIME.getName(), 
SortOrder.DESC);
+                break;
+            case
+                
BY_DURATION:searchRequestBuilder.addSort(SegmentDurationTable.DURATION.getName(),
 SortOrder.DESC);
+                break;
+        }
         searchRequestBuilder.setSize(limit);
         searchRequestBuilder.setFrom(from);
 
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/SegmentDurationH2UIDAO.java
 
b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/SegmentDurationH2UIDAO.java
index 4cc9e366b..5f154e831 100644
--- 
a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/SegmentDurationH2UIDAO.java
+++ 
b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/SegmentDurationH2UIDAO.java
@@ -31,7 +31,9 @@
 import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO;
 import 
org.apache.skywalking.apm.collector.storage.table.segment.SegmentDurationTable;
 import org.apache.skywalking.apm.collector.storage.ui.trace.BasicTrace;
+import org.apache.skywalking.apm.collector.storage.ui.trace.QueryOrder;
 import org.apache.skywalking.apm.collector.storage.ui.trace.TraceBrief;
+import org.apache.skywalking.apm.collector.storage.ui.trace.TraceState;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -48,7 +50,7 @@ public SegmentDurationH2UIDAO(H2Client client) {
 
     @Override
     public TraceBrief loadTop(long startSecondTimeBucket, long 
endSecondTimeBucket, long minDuration, long maxDuration,
-        String operationName, int applicationId, int limit, int from, 
String... segmentIds) {
+                              String operationName, int applicationId, int 
limit, int from, TraceState traceState, QueryOrder queryOrder, String... 
segmentIds) {
         H2Client client = getClient();
         String sql = "select * from {0} where {1} >= ? and {1} <= ?";
         List<Object> params = new ArrayList<>();
@@ -90,8 +92,30 @@ public TraceBrief loadTop(long startSecondTimeBucket, long 
endSecondTimeBucket,
             params.add(applicationId);
             columns.add(SegmentDurationTable.APPLICATION_ID.getName());
         }
+        if (traceState != null) {
+            paramIndex++;
+            sql = sql + " and {" + paramIndex + "} = ?";
+            switch (traceState) {
+                case ERROR:
+                    params.add(BooleanUtils.TRUE);
+                    break;
+                case SUCCESS:
+                    params.add(BooleanUtils.FALSE);
+                    break;
+            }
+
+            columns.add(SegmentDurationTable.IS_ERROR);
+        }
 
         sql = sql + " limit " + from + "," + limit;
+        switch (queryOrder) {
+            case BY_START_TIME:
+                sql = sql + " queryOrder by " + 
SegmentDurationTable.START_TIME.getName() + " dsc";
+                break;
+            case BY_DURATION:
+                sql = sql + " queryOrder by " + 
SegmentDurationTable.DURATION.getName() + " dsc";
+                break;
+        }
         sql = SqlBuilder.buildSql(sql, columns);
         Object[] p = params.toArray(new Object[0]);
 
diff --git 
a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/TraceQuery.java
 
b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/TraceQuery.java
index 595adc555..12461838a 100644
--- 
a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/TraceQuery.java
+++ 
b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/TraceQuery.java
@@ -22,9 +22,7 @@
 import org.apache.skywalking.apm.collector.core.module.ModuleManager;
 import org.apache.skywalking.apm.collector.core.util.Const;
 import org.apache.skywalking.apm.collector.core.util.StringUtils;
-import org.apache.skywalking.apm.collector.storage.ui.trace.Trace;
-import org.apache.skywalking.apm.collector.storage.ui.trace.TraceBrief;
-import 
org.apache.skywalking.apm.collector.storage.ui.trace.TraceQueryCondition;
+import org.apache.skywalking.apm.collector.storage.ui.trace.*;
 import org.apache.skywalking.apm.collector.ui.graphql.Query;
 import org.apache.skywalking.apm.collector.ui.service.SegmentTopService;
 import org.apache.skywalking.apm.collector.ui.service.TraceStackService;
@@ -81,9 +79,11 @@ public TraceBrief queryBasicTraces(TraceQueryCondition 
condition) throws ParseEx
         long maxDuration = condition.getMaxTraceDuration();
         String operationName = condition.getOperationName();
         int applicationId = condition.getApplicationId();
+        TraceState traceState = condition.getTraceState();
+        QueryOrder queryOrder = condition.getQueryOrder();
 
         PaginationUtils.Page page = 
PaginationUtils.INSTANCE.exchange(condition.getPaging());
-        return getSegmentTopService().loadTop(startSecondTimeBucket, 
endSecondTimeBucket, minDuration, maxDuration, operationName, traceId, 
applicationId, page.getLimit(), page.getFrom());
+        return getSegmentTopService().loadTop(startSecondTimeBucket, 
endSecondTimeBucket, minDuration, maxDuration, operationName, traceId, 
applicationId, page.getLimit(), page.getFrom(),traceState,queryOrder);
     }
 
     public Trace queryTrace(String traceId) {
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 55a356f28..e16b902b2 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
@@ -25,7 +25,9 @@
 import org.apache.skywalking.apm.collector.storage.StorageModule;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IGlobalTraceUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.ISegmentDurationUIDAO;
+import org.apache.skywalking.apm.collector.storage.ui.trace.QueryOrder;
 import org.apache.skywalking.apm.collector.storage.ui.trace.TraceBrief;
+import org.apache.skywalking.apm.collector.storage.ui.trace.TraceState;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,12 +47,12 @@ public SegmentTopService(ModuleManager moduleManager) {
     }
 
     public TraceBrief loadTop(long startSecondTimeBucket, long 
endSecondTimeBucket, long minDuration, long maxDuration,
-        String operationName,
-        String traceId, int applicationId, int limit, int from) {
+                              String operationName,
+                              String traceId, int applicationId, int limit, 
int from, TraceState traceState, QueryOrder queryOrder) {
         logger.debug("startSecondTimeBucket: {}, endSecondTimeBucket: {}, 
minDuration: {}, " +
-                "maxDuration: {}, operationName: {}, traceId: {}, 
applicationId: {}, limit: {}, from: {}",
+                "maxDuration: {}, operationName: {}, traceId: {}, 
applicationId: {}, limit: {}, from: {}, traceState: {}, queryOrder: {}",
             startSecondTimeBucket, endSecondTimeBucket, minDuration,
-            maxDuration, operationName, traceId, applicationId, limit, from);
+            maxDuration, operationName, traceId, applicationId, limit, 
from,traceState,queryOrder);
 
         TraceBrief traceBrief;
         if (StringUtils.isNotEmpty(traceId)) {
@@ -58,9 +60,9 @@ public TraceBrief loadTop(long startSecondTimeBucket, long 
endSecondTimeBucket,
             if (CollectionUtils.isEmpty(segmentIds)) {
                 return new TraceBrief();
             }
-            traceBrief = segmentDurationUIDAO.loadTop(startSecondTimeBucket, 
endSecondTimeBucket, minDuration, maxDuration, operationName, applicationId, 
limit, from, segmentIds.toArray(new String[0]));
+            traceBrief = segmentDurationUIDAO.loadTop(startSecondTimeBucket, 
endSecondTimeBucket, minDuration, maxDuration, operationName, applicationId, 
limit, from, traceState, queryOrder, segmentIds.toArray(new String[0]));
         } else {
-            traceBrief = segmentDurationUIDAO.loadTop(startSecondTimeBucket, 
endSecondTimeBucket, minDuration, maxDuration, operationName, applicationId, 
limit, from);
+            traceBrief = segmentDurationUIDAO.loadTop(startSecondTimeBucket, 
endSecondTimeBucket, minDuration, maxDuration, operationName, applicationId, 
limit, from, traceState, queryOrder);
         }
 
         traceBrief.getTraces().forEach(trace -> {
diff --git 
a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/ui/query/TraceQueryTest.java
 
b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/ui/query/TraceQueryTest.java
index c6a655e2e..1368af3ac 100644
--- 
a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/ui/query/TraceQueryTest.java
+++ 
b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/ui/query/TraceQueryTest.java
@@ -21,7 +21,9 @@
 import org.apache.skywalking.apm.collector.storage.ui.common.Duration;
 import org.apache.skywalking.apm.collector.storage.ui.common.Pagination;
 import org.apache.skywalking.apm.collector.storage.ui.common.Step;
+import org.apache.skywalking.apm.collector.storage.ui.trace.QueryOrder;
 import 
org.apache.skywalking.apm.collector.storage.ui.trace.TraceQueryCondition;
+import org.apache.skywalking.apm.collector.storage.ui.trace.TraceState;
 import org.apache.skywalking.apm.collector.ui.service.SegmentTopService;
 import org.apache.skywalking.apm.collector.ui.service.TraceStackService;
 import org.junit.Assert;
@@ -61,12 +63,14 @@ public void queryBasicTraces() throws ParseException {
         duration.setEnd("2017-02");
         duration.setStep(Step.MONTH);
         traceQueryCondition.setQueryDuration(duration);
+        traceQueryCondition.setQueryOrder(QueryOrder.BY_START_TIME);
+        traceQueryCondition.setTraceState(TraceState.ALL);
         traceQueryCondition.setPaging(new Pagination());
         Mockito.when(segmentTopService.loadTop(
                 Mockito.anyLong(), Mockito.anyLong(),
                 Mockito.anyLong(), Mockito.anyLong(),
                 Mockito.anyString(), Mockito.anyString(),
-                Mockito.anyInt(), Mockito.anyInt(), Mockito.anyInt()
+                Mockito.anyInt(), Mockito.anyInt(), Mockito.anyInt(), 
Mockito.anyObject(), Mockito.anyObject()
                 )
         ).then(invocation -> {
             Object[] arguments = invocation.getArguments();
diff --git 
a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/ui/service/SegmentTopServiceTest.java
 
b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/ui/service/SegmentTopServiceTest.java
index c9de3545c..d7274652b 100644
--- 
a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/ui/service/SegmentTopServiceTest.java
+++ 
b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/ui/service/SegmentTopServiceTest.java
@@ -24,7 +24,9 @@
 import org.apache.skywalking.apm.collector.storage.ui.common.Duration;
 import org.apache.skywalking.apm.collector.storage.ui.common.Step;
 import org.apache.skywalking.apm.collector.storage.ui.trace.BasicTrace;
+import org.apache.skywalking.apm.collector.storage.ui.trace.QueryOrder;
 import org.apache.skywalking.apm.collector.storage.ui.trace.TraceBrief;
+import org.apache.skywalking.apm.collector.storage.ui.trace.TraceState;
 import org.apache.skywalking.apm.collector.ui.utils.DurationUtils;
 import org.junit.Assert;
 import org.junit.Before;
@@ -68,11 +70,11 @@ public void loadTop() throws ParseException {
         long startSecondTimeBucket = 
DurationUtils.INSTANCE.startTimeDurationToSecondTimeBucket(duration.getStep(), 
duration.getStart());
         long endSecondTimeBucket = 
DurationUtils.INSTANCE.endTimeDurationToSecondTimeBucket(duration.getStep(), 
duration.getEnd());
         when(globalTraceUIDAO.getSegmentIds(anyString())).then(invocation -> 
Collections.singletonList("segmentIds"));
-        when(segmentDurationUIDAO.loadTop(anyLong(), anyLong(), anyLong(), 
anyLong(), anyString(), anyInt(), anyInt(), anyInt())).then(invocation -> 
getTrace());
-        when(segmentDurationUIDAO.loadTop(anyLong(), anyLong(), anyLong(), 
anyLong(), anyString(), anyInt(), anyInt(), anyInt(), 
anyObject())).then(invocation -> getTrace());
-        TraceBrief traceBrief = 
segmentTopService.loadTop(startSecondTimeBucket, endSecondTimeBucket, 0, 1, 
"test", null, 1, 10, 0);
+        when(segmentDurationUIDAO.loadTop(anyLong(), anyLong(), anyLong(), 
anyLong(), anyString(), anyInt(), anyInt(), 
anyInt(),anyObject(),anyObject())).then(invocation -> getTrace());
+        when(segmentDurationUIDAO.loadTop(anyLong(), anyLong(), anyLong(), 
anyLong(), anyString(), anyInt(), anyInt(), anyInt(), 
anyObject(),anyObject(),anyObject())).then(invocation -> getTrace());
+        TraceBrief traceBrief = 
segmentTopService.loadTop(startSecondTimeBucket, endSecondTimeBucket, 0, 1, 
"test", null, 1, 10, 0,TraceState.ALL,QueryOrder.BY_START_TIME);
         Assert.assertTrue(traceBrief.getTraces().size() == 1);
-        traceBrief = segmentTopService.loadTop(startSecondTimeBucket, 
endSecondTimeBucket, 0, 1, "test", "traceId", 1, 10, 0);
+        traceBrief = segmentTopService.loadTop(startSecondTimeBucket, 
endSecondTimeBucket, 0, 1, "test", "traceId", 1, 10, 
0,TraceState.ALL,QueryOrder.BY_START_TIME);
         Assert.assertTrue(traceBrief.getTraces().size() == 1);
     }
 
diff --git 
a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/trace.graphqls 
b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/trace.graphqls
index 4d17d58c8..e6f336b28 100644
--- a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/trace.graphqls
+++ b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/trace.graphqls
@@ -42,9 +42,17 @@ input TraceQueryCondition {
   minTraceDuration: Int
   # The max time of trace
   maxTraceDuration: Int
+  traceState: TraceState!
+  queryOrder: QueryOrder!
   paging: Pagination!
 }
 
+enum TraceState {
+  ALL
+  SUCCESS
+  ERROR
+}
+
 enum QueryOrder {
   BY_START_TIME
   BY_DURATION


 

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to