Skip to content

Incorrect parent for async subsegment #419

Description

@xendo

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);
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions