aws / aws-xray-sdk-node

The official AWS X-Ray SDK for Node.js.
Apache License 2.0
266 stars 155 forks source link

captureAWSv3Client within subsegment #663

Open petermyers opened 2 months ago

petermyers commented 2 months ago

I'm attempting to instrument a NodeJS Lambda using Xray. Throughout the invocation, I create a number of subsegments, and within each, I issue dynamodb queries. The calls to DDB display in the xray trace as a standalone subsegment nested under the root 'Invocation' segment, rather than under my own subsegment.

Is this supported? Do I need to pass in some options to the captureAWSv3Client call or to the client query call directly to indicate what the parent segment is? Since the prescribed best practice is to create the sdk client outside of the lambda handle function so it can be re-used across invocations, should I be calling captureAWSv3Client during each invocation?

Thanks!