You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2019/11/20 12:56:33 UTC

[GitHub] [skywalking] kezhenxu94 commented on a change in pull request #3906: Support ordered segment list in trace query

kezhenxu94 commented on a change in pull request #3906: Support ordered segment list in trace query
URL: https://github.com/apache/skywalking/pull/3906#discussion_r348465459
 
 

 ##########
 File path: oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/TraceQueryService.java
 ##########
 @@ -374,6 +390,14 @@ public Trace queryTrace(final String traceId) throws IOException {
                 rootSpans.add(span);
             }
         });
+        /**
+         * In some cases, there are segment fragments, which could not be linked by Ref,
+         * because of two kinds of reasons.
+         * 1. Multiple leaf segments have no particular order in the storage.
+         * 2. Lost in sampling, agent fail safe, segment lost, even bug.
+         * Sorting the segments makes the trace view more readable.
+         */
+        rootSpans.sort(Comparator.comparing(span -> new Long(span.getStartTime())));
 
 Review comment:
   Seems no need to box `span.getStartTime()`, and can be simplified with method reference

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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