DataDog / datadog-lambda-js

The Datadog AWS Lambda Library for Node
Apache License 2.0
109 stars 35 forks source link

When capturing lambda payload, always cast number into string for sec… #422

Closed joeyzhao2018 closed 1 year ago

joeyzhao2018 commented 1 year ago

…urity reasons.

What does this PR do?

When the env DD_CAPTURE_LAMBDA_PAYLOAD set to true, the datadog-lambda-js library can capture the lambda's request and responses by parsing them and tagging the span with the keys and values. This change is to make sure no values are tagged as number by casting them into strings.

Motivation

Treating the payloads values as string for this very payload capturing feature is expected behavior. This does't change the payload. This is strictly for the payload capturing feature and it does't imply other scenarios should follow the same pattern.

Testing Guidelines

This has been tested in our serverless sandbox us-west-2 region joey-node-hello-world lambda. For serverless teammates, feel free to check its environment setting and test

Additional Notes

Types of Changes

Check all that apply

codecov-commenter commented 1 year ago

Codecov Report

Merging #422 (1f75b35) into main (a44624f) will not change coverage. The diff coverage is 100.00%.

:exclamation: Current head 1f75b35 differs from pull request most recent head 57e9275. Consider uploading reports for the commit 57e9275 to get more accurate results

@@           Coverage Diff           @@
##             main     #422   +/-   ##
=======================================
  Coverage   80.80%   80.80%           
=======================================
  Files          38       38           
  Lines        2001     2001           
  Branches      466      466           
=======================================
  Hits         1617     1617           
  Misses        323      323           
  Partials       61       61           
Files Changed Coverage Δ
src/utils/tag-object.ts 84.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more