Skip to content

Commit c270c00

Browse files
authored
Fix canary tests failure if the trace validation gets started over 20 sec later than trace end time. (#346)
*Issue description:* https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12600973822/job/35121135907 The issues is noticed in IAD because the test account has a large number of traces in IAD, triggers the pagination when validator calls GetTraceSummaries. Since the targeted trace is not in the first page, validator always failed. *Description of changes:* *Rollback procedure:* <Can we safely revert this commit if needed? If not, detail what must be done to safely revert and why it is needed.> *Ensure you've run the following tests on your changes and include the link below:* To do so, create a `test.yml` file with `name: Test` and workflow description to test your changes, then remove the file for your PR. Link your test run in your PR description. This process is a short term solution while we work on creating a staging environment for testing. NOTE: TESTS RUNNING ON A SINGLE EKS CLUSTER CANNOT BE RUN IN PARALLEL. See the [needs](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idneeds) keyword to run tests in succession. - Run Java EKS on `e2e-playground` in us-east-1 and eu-central-2 - Run Python EKS on `e2e-playground` in us-east-1 and eu-central-2 - Run metric limiter on EKS cluster `e2e-playground` in us-east-1 and eu-central-2 - Run EC2 tests in all regions - Run K8s on a separate K8s cluster (check IAD test account for master node endpoints; these will change as we create and destroy clusters for OS patching) By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent b384fcf commit c270c00

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

validator/src/main/java/com/amazon/aoc/services/XRayService.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.amazonaws.services.xray.model.GetTraceSummariesResult;
2424
import com.amazonaws.services.xray.model.Trace;
2525
import com.amazonaws.services.xray.model.TraceSummary;
26+
import java.util.ArrayList;
2627
import java.util.Date;
2728
import java.util.List;
2829
import org.joda.time.DateTime;
@@ -53,12 +54,21 @@ public List<Trace> listTraceByIds(List<String> traceIdList) {
5354
public List<TraceSummary> searchTraces(String traceFilter) {
5455
Date currentDate = new Date();
5556
Date pastDate = new DateTime(currentDate).minusSeconds(SEARCH_PERIOD).toDate();
56-
GetTraceSummariesResult traceSummaryResult =
57-
awsxRay.getTraceSummaries(
58-
new GetTraceSummariesRequest()
59-
.withStartTime(pastDate)
60-
.withEndTime(currentDate)
61-
.withFilterExpression(traceFilter));
62-
return traceSummaryResult.getTraceSummaries();
57+
List<TraceSummary> allSummaries = new ArrayList<>();
58+
String nextToken = null;
59+
do {
60+
GetTraceSummariesResult traceSummaryResult =
61+
awsxRay.getTraceSummaries(
62+
new GetTraceSummariesRequest()
63+
.withStartTime(pastDate)
64+
.withEndTime(currentDate)
65+
.withFilterExpression(traceFilter)
66+
.withNextToken(nextToken));
67+
68+
allSummaries.addAll(traceSummaryResult.getTraceSummaries());
69+
nextToken = traceSummaryResult.getNextToken();
70+
} while(nextToken != null);
71+
72+
return allSummaries;
6373
}
6474
}

0 commit comments

Comments
 (0)