aws/aws-xray-sdk-node

xray whitelist for additional data capture does not work with AWS Javascript v3 SDK clients

Closed this issue · 11 comments

Using X-Ray with the AWS Javascript v3 SDK clients prints out debug logging messages that indicate the additional data captured in the v2 clients via the whitelist is not applied to the v3 clients.

Example Log:

Call \"DynamoDB.GetItem\" is not whitelisted for additional data capturing. Ignoring.

(similar messages appear for other SDK API calls)

This is the default whitelist that is included in the AWS X-Ray SDK:
aws_xray_whitelist.json.txt

I have tried manually setting the whitelist (see below) and leaving it unset (the default behavior).

import AWSXRay from 'aws-xray-sdk';
const whitelist: any = require('aws-xray-sdk-core/dist/lib/resources/aws_whitelist.json');
AWSXRay.setAWSWhitelist(whitelist);

When I look at the trace in the X-Ray console, I see the following in the Resources tab (for the trace):

Retries    | 1
Region     | us-east-1
Operation  | GetItem
Request ID | USTUCFQJA974H461PMB95LLL73VV4KQNSO5AEMVJF66Q9ASUAAJG

the annotations, resources and exceptions tabs have no data (for successful requests).

Is there a special way to enabled the extra data capture for v3 SDK clients?

HI @thesuavehog,

Unfortunately this feature for capturing additional data is not yet available with v3 clients because the AWS SDK v3 uses a different data model for storing request/response attributes. We will keep this open as a feature request for adding that support. One possible alternative for a workaround would be to add hooks for the AWS SDK v3 patcher so that custom logic could be added to capture these attributes.

@willarmiros re: add hooks for the AWS SDK v3 patcher
Is that something I can do on my project or is that something that has to be done on the SDK level?

also, there's a LOT of debug output from X-Ray related to the whitelisting which is annoying when trying to parse out my own debug logs. If this is not a supported feature, then X-Ray should not output the debug logs on EVERY call (in my opinion).

If you want to output 1 log item when a client is initially wrapped as an FYI, that's fine, but the current verboseness is annoying =)

@willarmiros re: add hooks for the AWS SDK v3 patcher
Is that something I can do on my project or is that something that has to be done on the SDK level?

At the SDK level, e.g. something similar to #299 but for AWS SDK requests.

Regarding logging, I don't disagree and would be open to a PR there but of course we don't recommend debug logs to be enabled typically because of their verbosity

ok, I may look into doing a PR then - hopefully it will only be a small fix.

I turn on debug logging frequently when I'm, well, debugging ;) ... which happens a lot.
All of my TypeScript serverless projects use structured (JSON) logging as it's much easier to search in CloudWatch, and I pass my logger in to X-Ray so it's logs are structured and searchable too... but it means I get it's debug output mixed into my application's.

anyway, I'll see about doing a PR

I'm running into the same problem but it's not really clear to me what the workaround is to capture for example the table name. Any examples you can point me to to figure this out further?

+1

Hi @willarmiros could you take a look at a proposed solution? The PR adds missing fields to AWS service segment used in the patcher for SDK v3.

Someone will take a look shortly @SergeyPoluektov!

There is any news about it @willarmiros. There is a global warning to migrate to aws-sdk-v3 urgent but doing that I'm still stuck with the awful graph shown each service like Dynamo and S3 like a single node instead of tables and buckets.

The fix has been release in v3.5.2. Please check it out and let us know if the issue still persists.