Search code examples
javaamazon-web-servicesspring-bootaws-xray

Non correlated segments generated by AWS X-Ray


I have two services(Java), between them is a relationship A depends on B. These two services are deployed on two AWS EB with X-Ray enabled. When I make a HTTP request to the service A, the AWS X-Ray Console shows me the segments of service A and B but there is no edge between service A and B.

My question is why the segment of B has the field ParentId equal to null.

I expect Client --> Service A --> Service B to be on service graph instead of Client --> Service A and Client --> Service B.

Do you have any idea?

Thank you


Solution

  • You are right that the parent id for B should not be null if you are calling A from B.

    Are A and B in the same trace, i.e. they have the same trace id? How are you calling B from A. The connection between A and B is made when the parent id is propagated from the caller to the callee. In case of HTTP the an additional header should be passed from A to B that contains the parent id along with the trace ID. Read here for more details.

    You should see a subsegment on the segment A that signifies the client side call from A to B. The id of this subsegment becomes the parent id of the downstream service B. This is how the connection is established.

    To make it easy for clients to propagate this header aws-xray sdk provide a helper HTTP client that allows passing this header to the downstream automatically. Are you using this HTTP client? http://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-java-httpclients.html