Tips for Manual X-Ray Instrumentation of Java App

0

Hi,

We're trying to instrument our services using AWS X-Ray. Most of the app that we're interested in instrumenting doesn't get passed X-Ray trace ids but instead are called every quarter of a second via a timer to generate data and then pass downstream to another service (via TCP) before sending to clients over websockets. As far as we have found this requires manual instrumentation and we have setup the app to create a segment, create subsegments for parts of the code we would like to additionally instrument before passing the trace-id and parent-id downstream for the other services to pick up and continue using for their own subsegments.

Running the app locally we can see X-Ray trace information in the dashboard and all appears okay. From reading the documentation however, it's unclear whether this is enough or whether we need to do additional work to ensure we're picking up the sampling rules or whether this is something the AWS-SDK will be doing automatically. It is also unclear whether we need to pass more than the trace-id and parent-id downstream as I have seen in some of the examples also passing a flag indicating whether the current trace is being actively traced. If anyone can let me know the ideal way of manually generating traces and passing between services that'd be extremely helpful.

Regards

asked 2 years ago538 views
1 Answer
0

Hi,

XRay SDK provides APIs and dependencies to automatically handle context propagation between services. The sampled flag is a part of trace context, refer to xray concept trace header. By default, XRay SDK uses 1/second + 5% sampling rate, user no need manually set sampled flag.

A good way to start onboard tracing system is from opentelemetry doc. Basically all of SDKs are same, provide ready-to-use APIs that no need SDK user to manually handle trace id, segment id, sampled flag and context propagation between services. Please check the user doc and start from a sample app.

AWS
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions