Segment Executor not running in background
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- aws, java, spring-boot
- Domain
- backend, observability-sre
Research direction
Start by reproducing the /async-test endpoint with @Async and SegmentContextExecutors.newSegmentContextExecutor(), comparing it with CompletableFuture.supplyAsync without that executor. Trace why the request waits for three seconds and verify that the resolved behavior returns promptly while retaining segment logging.
Written by the indexing model from the issue text.
Description
I have an api like this
@GetMapping("/async-test")
public String api2() throws InterruptedException {
log.info("Before async");
myService.myAsync();
log.info("after async");
return "nothing important";
}
And myService.myAsync implementation like this
@Async
public void myAsync() {
CompletableFuture.supplyAsync(() -> {
try {
log.info("before thread ....");
Thread.sleep(3000);
log.info("after thread ....");
} catch (InterruptedException e) {
throw new IllegalStateException(e);
}
log.info("before returning result ....");
return "Result of the asynchronous computation";
}, SegmentContextExecutors.newSegmentContextExecutor());
}
The issue here is that API waits for 3 seconds to reply when using SegmentContextExecutors.newSegmentContextExecutor(), but if I remove the segment executor, the function run in the background successfully, but for sure I lose the segment logging.
So what should be done to fix this ?
Tech stack
Spring boot v.2.7.2
Java 11
Aws x-ray v.2.11.2
- Dominant language
- Java
- Stars
- 100
- Forks
- 100
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aws/aws-xray-sdk-java
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
aws/aws-xray-sdk-java#441 ·
-
An exception SegmentNotFoundException when starting the project with aws-xray-java-agent 2.18.2 Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
aws/aws-xray-sdk-java#421 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
aws/aws-xray-sdk-java#420 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
aws/aws-xray-sdk-java#419 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
aws/aws-xray-sdk-java#416 · 1 comment ·
All issues in aws/aws-xray-sdk-java
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100