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

已提问 2 年前548 查看次数
1 回答
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
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则