Skip to content

Commit

Permalink
#316: Adds support for http/https APIs for node >= 10
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethaasan authored and nijotz committed Feb 21, 2020
1 parent 3449921 commit 94c2f0f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 40 deletions.
21 changes: 6 additions & 15 deletions lib/instrumentation/core/http.js
Expand Up @@ -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(
Expand Down
43 changes: 19 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -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"
Expand Down

0 comments on commit 94c2f0f

Please sign in to comment.