Replies: 2 comments
-
HI, I have come up with an idea how I would be able to solve it, yet the method used from aws-xray-sdk-core Powertools tracer provider was restricted to 1 parameter instead of its original 2. I wouldn't mind if it was on the tracer itself, but I thought that the provider object would allow me to use the provider (in this case aws-xray-sdk) the way it was written x-ray-sdk. |
Beta Was this translation helpful? Give feedback.
-
Hey, sorry for the delay - I spent some time thinking about your question and unfortunately I didn't come up with anything very useful. The use case you're describing is valid however you're hitting a limitation of the X-Ray SDK for Node.js when working with promises. The X-Ray SDK uses on an older version of context tracking based on this module, which in turns uses Node.js Because of this, the whole context tracking for segments breaks down when running parallel async code - which is also why we added the workaround you linked to the docs. When it comes to patched AWS SDK clients however the parent segment is resolved automatically based on the currently active one, which breaks the workaround. With this in mind, I am unsure how to get around this beyond suggesting to not use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, as title states I have found myself stuck on an issue of producing AWS X-ray segments per each record processed with a batch utility.
As documentation correctly suggests Batch processing | Tracing with AWS X-Ray, when working inside of a recordHandler, it makes sense to work with the created subsegment directly since they provide an object with which we can work independently for every invocation of the recordHandler.
On the other hand, other utilities like logger would require us to spawn a child logger to eliminate a possibility of appended keys' override by handlers which were invoked concurrently.
This brings us to the issue: what if my recordHandler uses aws sdk client patched by tracer?
Ideally, we would want to be able to produce the following structure, however there is no way for tracer to know to which segment it should attach a new subsegment to correctly show the connections.
The use case for such x-ray trace would be that it represents the reality in which recordHandlers run concurrently + if recordHandler segment would put an annotation with some sort of message id, then it would allow for queries like: Which segments have failed while processing a message with id "123".
However, as you might imagine, depending on how long each recorHandler takes to execute the x-ray trace may take a shape of an arbitrary structure which would make it hard to interpret parent/child relationships of trace segment.
So, in summary, do you have an idea of how such tracing may be accomplished and whether it's even possible?
Beta Was this translation helpful? Give feedback.
All reactions