From 94c2f0fde860f153fc8402c5c5a5ba6d4f6230a5 Mon Sep 17 00:00:00 2001 From: Kenneth Aasan Date: Wed, 18 Dec 2019 12:58:47 -0800 Subject: [PATCH] #316: Adds support for http/https APIs for node >= 10 --- lib/instrumentation/core/http.js | 21 +++++----------- package-lock.json | 43 ++++++++++++++------------------ package.json | 2 +- 3 files changed, 26 insertions(+), 40 deletions(-) diff --git a/lib/instrumentation/core/http.js b/lib/instrumentation/core/http.js index 0d071a9612..fb67c87ae5 100644 --- a/lib/instrumentation/core/http.js +++ b/lib/instrumentation/core/http.js @@ -489,21 +489,12 @@ module.exports = function initialize(agent, http, moduleName) { wrapRequest.bind(null, agent) ) - // Upon updating to https-proxy-agent v2, we are now using - // agent-base v4, which patches https.get to use https.request. - // - // https://github.com/TooTallNate/node-agent-base/commit/7de92df780e147d4618 - // - // This means we need to skip instrumenting to avoid double - // instrumenting external requests. - if (!IS_HTTPS && psemver.satisfies('>=8')) { - shimmer.wrapMethod( - http, - 'http', - 'get', - wrapRequest.bind(null, agent) - ) - } + shimmer.wrapMethod( + http, + 'http', + 'get', + wrapRequest.bind(null, agent) + ) } shimmer.wrapMethod( diff --git a/package-lock.json b/package-lock.json index 0c1fc0262d..4c9fdc1a77 100644 --- a/package-lock.json +++ b/package-lock.json @@ -365,12 +365,9 @@ "dev": true }, "agent-base": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", - "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", - "requires": { - "es6-promisify": "^5.0.0" - } + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", + "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==" }, "ajv": { "version": "6.10.2", @@ -1211,6 +1208,7 @@ "version": "3.2.6", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, "requires": { "ms": "^2.1.1" } @@ -1430,19 +1428,6 @@ "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", "dev": true }, - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" - }, - "es6-promisify": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", - "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", - "requires": { - "es6-promise": "^4.0.3" - } - }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -2407,12 +2392,22 @@ } }, "https-proxy-agent": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-3.0.1.tgz", - "integrity": "sha512-+ML2Rbh6DAuee7d07tYGEKOEi2voWPUGan+ExdPbPW6Z3svq+JCqr0v8WmKPOkz1vOVykPCBSuobe7G8GJUtVg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", + "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", "requires": { - "agent-base": "^4.3.0", - "debug": "^3.1.0" + "agent-base": "5", + "debug": "4" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + } } }, "iconv-lite": { diff --git a/package.json b/package.json index 19760a8fb2..224acf40d5 100644 --- a/package.json +++ b/package.json @@ -136,7 +136,7 @@ "concat-stream": "^2.0.0", "escodegen": "^1.11.1", "esprima": "^4.0.1", - "https-proxy-agent": "^3.0.0", + "https-proxy-agent": "^4.0.0", "json-stringify-safe": "^5.0.0", "readable-stream": "^3.1.1", "semver": "^5.3.0"