Search code examples
node.jsamazon-web-servicesaws-sdk-nodejsaws-xray

What are the equivalents of AWSXRay captureHTTPsGlobal and captureAWS methods in @aws-sdk/client-xray?


In my code, I'm using aws-xray-sdk at the moment and I want to migrate to @aws-sdk/client-xray, XRay Client - AWS SDK for JavaScript v3. I have the following piece of code and my question is what would be a replacement for it using the new xray client? Apart from XRay, I use S3, SES, and SQS.

  import * as https from 'https';
  import AWSXRay from 'aws-xray-sdk';
  import AWS from 'aws-sdk';

  AWSXRay.captureHTTPsGlobal(https, false);
  AWSXRay.captureAWS(AWS);

Solution

  • AWS SDK for JavaScript v3 and AWS XRay SDK for node they are 2 different packages. Migrating AWS SDK for JavaScript from v2 to v3 means user has to modify their application code by following https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/index.html

    If user is using AWS XRay SDK for node instrument AWS SDK for JavaScript v3 in his application, please follow instruction https://github.com/aws/aws-xray-sdk-node/tree/master/packages/core#capture-outgoing-aws-requests-on-a-single-client