datadog-lambda-js
Advanced tools
Comparing version 3.41.0 to 3.42.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.datadogLambdaVersion = void 0; | ||
exports.datadogLambdaVersion = "3.41.0"; | ||
exports.datadogLambdaVersion = "3.42.0"; | ||
//# sourceMappingURL=constants.js.map |
@@ -26,3 +26,3 @@ "use strict"; | ||
exports.awsXrayDaemonAddressEnvVar = "AWS_XRAY_DAEMON_ADDRESS"; | ||
exports.ddtraceVersion = "0.29.1"; | ||
exports.ddtraceVersion = "0.30.0"; | ||
//# sourceMappingURL=constants.js.map |
@@ -85,8 +85,10 @@ "use strict"; | ||
var fn = function (arg1, arg2, arg3) { | ||
var _a = normalizeArgs(arg1, arg2, arg3), options = _a.options, callback = _a.callback; | ||
var requestOpts = getRequestOptionsWithTraceContext(options, contextService); | ||
if (isIntegrationTest()) { | ||
_logHttpRequest(requestOpts); | ||
var _a; | ||
_a = __read(addTraceContextToArgs(contextService, arg1, arg2, arg3), 3), arg1 = _a[0], arg2 = _a[1], arg3 = _a[2]; | ||
if (arg3 === undefined || arg3 === null) { | ||
return original(arg1, arg2); | ||
} | ||
return original(requestOpts, callback); | ||
else { | ||
return original(arg1, arg2, arg3); | ||
} | ||
}; | ||
@@ -102,16 +104,31 @@ return fn; | ||
/** | ||
* The input into the http.request function has 6 different overloads. This method normalized the inputs | ||
* into a consistent format. | ||
* Finds the RequestOptions in the args and injects context into headers | ||
*/ | ||
function normalizeArgs(arg1, arg2, arg3) { | ||
var options = typeof arg1 === "string" ? url_1.parse(arg1) : __assign({}, arg1); | ||
options.headers = options.headers || {}; | ||
var callback = arg3; | ||
if (typeof arg2 === "function") { | ||
callback = arg2; | ||
function addTraceContextToArgs(contextService, arg1, arg2, arg3) { | ||
var requestOpts; | ||
if (typeof arg1 === "string" || arg1 instanceof url_1.URL) { | ||
if (arg2 === undefined || arg2 === null) { | ||
requestOpts = { | ||
method: "GET", | ||
}; | ||
requestOpts = getRequestOptionsWithTraceContext(requestOpts, contextService); | ||
return [arg1, requestOpts, arg3]; | ||
} | ||
else if (typeof arg2 === "function") { | ||
requestOpts = { | ||
method: "GET", | ||
}; | ||
requestOpts = getRequestOptionsWithTraceContext(requestOpts, contextService); | ||
return [arg1, requestOpts, arg2]; | ||
} | ||
else { | ||
requestOpts = arg2; | ||
requestOpts = getRequestOptionsWithTraceContext(requestOpts, contextService); | ||
return [arg1, requestOpts, arg3]; | ||
} | ||
} | ||
else if (typeof arg2 === "object") { | ||
options = __assign(__assign({}, options), arg2); | ||
else { | ||
requestOpts = getRequestOptionsWithTraceContext(arg1, contextService); | ||
return [requestOpts, arg2, arg3]; | ||
} | ||
return { options: options, callback: callback }; | ||
} | ||
@@ -125,3 +142,9 @@ function getRequestOptionsWithTraceContext(options, traceService) { | ||
headers = __assign(__assign({}, headers), traceHeaders); | ||
return __assign(__assign({}, options), { headers: headers }); | ||
var requestOpts = __assign(__assign({}, options), { headers: headers }); | ||
// Logging all http requests during integration tests let's | ||
// us track traffic in our test snapshots | ||
if (isIntegrationTest()) { | ||
_logHttpRequest(requestOpts); | ||
} | ||
return requestOpts; | ||
} | ||
@@ -128,0 +151,0 @@ function isIntegrationTest() { |
{ | ||
"name": "datadog-lambda-js", | ||
"version": "3.41.0", | ||
"version": "3.42.0", | ||
"description": "Lambda client library that supports hybrid tracing in node js", | ||
@@ -20,13 +20,13 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@types/aws-lambda": "^8.10.64", | ||
"@types/aws-lambda": "^8.10.70", | ||
"@types/aws-sdk": "^2.7.0", | ||
"@types/jest": "^26.0.15", | ||
"@types/mock-fs": "true4.13.0", | ||
"@types/jest": "^26.0.20", | ||
"@types/mock-fs": "4.13.0", | ||
"@types/nock": "^11.1.0", | ||
"@types/node": "^14.14.10", | ||
"@types/node": "^14.14.20", | ||
"@types/promise-retry": "^1.1.3", | ||
"@types/shimmer": "^1.0.1", | ||
"dd-trace": "0.29.1", | ||
"dd-trace": "0.30.0", | ||
"jest": "^26.6.3", | ||
"mock-fs": "true4.13.0", | ||
"mock-fs": "4.13.0", | ||
"nock": "13.0.5", | ||
@@ -36,3 +36,3 @@ "prettier": "^2.2.1", | ||
"tslint": "^6.1.3", | ||
"typescript": "^4.1.2" | ||
"typescript": "^4.1.3" | ||
}, | ||
@@ -42,5 +42,5 @@ "dependencies": { | ||
"bignumber.js": "^9.0.1", | ||
"hot-shots": "8.2.0", | ||
"hot-shots": "8.3.0", | ||
"promise-retry": "^2.0.1", | ||
"serialize-error": "^7.0.1", | ||
"serialize-error": "^8.0.0", | ||
"shimmer": "^1.2.1" | ||
@@ -47,0 +47,0 @@ }, |
@@ -5,4 +5,4 @@ # datadog-lambda-js | ||
[![NPM](https://img.shields.io/npm/v/datadog-lambda-js)](https://www.npmjs.com/package/datadog-lambda-js) | ||
[![Slack](https://img.shields.io/badge/slack-%23serverless-blueviolet?logo=slack)](https://datadoghq.slack.com/channels/serverless/) | ||
[![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/DataDog/datadog-lambda-js/blob/master/LICENSE) | ||
[![Slack](https://chat.datadoghq.com/badge.svg?bg=632CA6)](https://chat.datadoghq.com/) | ||
[![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/DataDog/datadog-lambda-js/blob/main/LICENSE) | ||
@@ -119,4 +119,8 @@ Datadog Lambda Library for Node.js enables enhanced Lambda metrics, distributed tracing, and custom metric submission from AWS Lambda functions. | ||
If you find an issue with this package and have a fix, please feel free to open a pull request following the [procedures](https://github.com/DataDog/dd-lambda-js/blob/master/CONTRIBUTING.md). | ||
If you find an issue with this package and have a fix, please feel free to open a pull request following the [procedures](https://github.com/DataDog/dd-lambda-js/blob/main/CONTRIBUTING.md). | ||
## Community | ||
For product feedback and questions, join the `#serverless` channel in the [Datadog community on Slack](https://chat.datadoghq.com/). | ||
## License | ||
@@ -123,0 +127,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
235847
3310
129
+ Addedhot-shots@8.3.0(transitive)
+ Addedserialize-error@8.1.0(transitive)
+ Addedtype-fest@0.20.2(transitive)
- Removedhot-shots@8.2.0(transitive)
- Removedserialize-error@7.0.1(transitive)
- Removedtype-fest@0.13.1(transitive)
Updatedhot-shots@8.3.0
Updatedserialize-error@^8.0.0