aws / aws/aws-xray-sdk-java

Incorrect parent for async subsegment

Open
#419 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
100
Forks
100
PR merge metrics
No merged PRs in 30d

Description

I'm using Xray in async context and I noticed than when async subsegment is closed it will still be a parent for new subsegments. The expected behavior is that when a subsegment is closed it will be popped from the context.

```
@Test
void incorrectParrentForAsyncSubsegment() {
Segment parent = AWSXRay.beginSegment("parent");
Subsegment child1 = AWSXRay.beginSubsegment("child1");
AWSXRay.endSubsegment(child1);

Subsegment child2 = AWSXRay.beginSubsegment("child2");

// this passes, but it's incorrect the 'child1' was already closed when child2 was started
assertEquals(child2.getParent(), child1);

// this fails
assertEquals(child2.getParent(), parent);
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.