aws / aws-xray-sdk-node

The official AWS X-Ray SDK for Node.js.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding custom attributes to AWS SDK v3 calls

paddymccarroll opened this issue · comments

Is it possible to add our own custom attributes to segments created using captureAWSv3Client? For example, I would like to add query information from DynamoDB calls.

yes, AWS SDK v2 instrumentation is by middleware stack, user can customize XRay SDK's AWS sdk v3 instrumentation here https://github.com/aws/aws-xray-sdk-node/blob/e21281fc98d7a8a4eb2d96b64de60c295f474c1b/packages/core/lib/patchers/aws3_p.ts

One idea I haven't tried. User can add a new middleware after xray sdk's, use API AWSXRay.getSegment(); to add more attributes on AWS SDK v2 subsegment.

Thanks for pointing me in the right direction, I'll give that a go.