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 2018/05/05 15:26:09 UTC

[GitHub] candyleer opened a new pull request #1178: Fix If traceId not exists result will return all traces

candyleer opened a new pull request #1178: Fix If traceId not exists result will return all traces
URL: https://github.com/apache/incubator-skywalking/pull/1178
 
 
   Please answer these questions before submitting pull request
   
   - Why submit this pull request?
   - [x ] Bug fix
   - [ ] New feature provided
   - [ ] Improve performance
   
   - Related issues
   
   ___
   ### Bug fix
   - Bug description.
   ```java
   http://localhost:8000/api/trace
   
   
   {"variables":{"condition":{"traceId":"123","queryDuration":{"start":"2018-05-05 2302","end":"2018-05-05 2317","step":"MINUTE"},"paging":{"pageNum":1,"pageSize":20,"needTotal":true}}},"query":"\n  query BasicTraces($condition: TraceQueryCondition) {\n    queryBasicTraces(condition: $condition) {\n      traces {\n        key: segmentId\n        operationName\n        duration\n        start\n        isError\n        traceIds\n      }\n      total\n    }\n  }\n"}
   ```
   this will return all traces in server.
   
   ```java
   public TraceBrief queryBasicTraces(TraceQueryCondition condition) throws ParseException {
           long startSecondTimeBucket = 0;
           long endSecondTimeBucket = 0;
           String traceId = Const.EMPTY_STRING;
   
           if (StringUtils.isNotEmpty(condition.getTraceId())) {
               traceId = condition.getTraceId();
           } else if (nonNull(condition.getQueryDuration())) {
               startSecondTimeBucket = DurationUtils.INSTANCE.startTimeDurationToSecondTimeBucket(condition.getQueryDuration().getStep(), condition.getQueryDuration().getStart());
               endSecondTimeBucket = DurationUtils.INSTANCE.endTimeDurationToSecondTimeBucket(condition.getQueryDuration().getStep(), condition.getQueryDuration().getEnd());
           } else {
               throw new UnexpectedException("The condition must contains either queryDuration or traceId.");
           }
   
           long minDuration = condition.getMinTraceDuration();
           long maxDuration = condition.getMaxTraceDuration();
           String operationName = condition.getOperationName();
           int applicationId = condition.getApplicationId();
   
           PaginationUtils.Page page = PaginationUtils.INSTANCE.exchange(condition.getPaging());
           return getSegmentTopService().loadTop(startSecondTimeBucket, endSecondTimeBucket, minDuration, maxDuration, operationName, traceId, applicationId, page.getLimit(), page.getFrom());
       }
   ```
   - How to fix?
   
   ___
   ### New feature or improvement
   - Describe the details and related test reports.
   

----------------------------------------------------------------
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