How to implement x-ray instrumentation with Vertx microservices build in java? Is there is any sdk available for vertx aws-xray? I used java sdk but not getting service map.
2 Answers
As far as I know, X-Ray doesn't work with Vert.x in any form. The main reason for this is that the main method of propagating spans within X-Ray is using a Threadlocal to keep track of state.
Threadlocal will not work in a reactive framework like Vert.x, because of the context jumping between threads in the thread-pools in these kinds of frameworks. Spring WebFlux has the same problem.
We have been in contact with both AWS support and Amazon representatives, and the answer is always "we will look into this", however they don't seem very interested, as I suspect it needs a full rewrite to work properly.

- 11
- 1
-
add some more description and code if it's required to understand the answer because it will resolve someone else problem ASAP. – Nensi Kasundra May 12 '20 at 10:42
Currently, the AWS X-Ray SDK for Java does not provide a middleware or tracing support for Vert.x microservices architecture. The only supported frameworks are Tomcat and Spring. I am curious as to how are you using the Java SDK in your application.
One way to trace your application could be to use custom segments and subsegments (although it would mean you'll have to do a lot of manual instrumentation work).
You can begin a segment for your application by using beginSegment
method and set the appropriate properties. Then you can create subsegments for your downstream calls or any piece of code that you'd want to trace. Please refer to the doc for the semantic meaning of a Segment and Subsegment.

- 258
- 1
- 7