@opencensus/instrumentation-https
Advanced tools
Comparing version 0.0.17 to 0.0.18
@@ -45,3 +45,19 @@ "use strict"; | ||
if (semver.satisfies(this.version, '>=8.0.0')) { | ||
shimmer.wrap(this.moduleExports, 'get', this.getPatchHttpsOutgoingRequest()); | ||
shimmer.wrap(this.moduleExports, 'get', () => { | ||
// Re-implement http.get. This needs to be done (instead of using | ||
// getPatchOutgoingRequestFunction to patch it) because we need to | ||
// set the trace context header before the returned ClientRequest is | ||
// ended. The Node.js docs state that the only differences between | ||
// request and get are that (1) get defaults to the HTTP GET method and | ||
// (2) the returned request object is ended immediately. The former is | ||
// already true (at least in supported Node versions up to v9), so we | ||
// simply follow the latter. Ref: | ||
// https://nodejs.org/dist/latest/docs/api/http.html#http_http_get_options_callback | ||
// https://github.com/googleapis/cloud-trace-nodejs/blob/master/src/plugins/plugin-http.ts#L198 | ||
return function getTrace(options, callback) { | ||
const req = https.request(options, callback); | ||
req.end(); | ||
return req; | ||
}; | ||
}); | ||
} | ||
@@ -48,0 +64,0 @@ return this.moduleExports; |
{ | ||
"name": "@opencensus/instrumentation-https", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"description": "Opencensus https automatic instrumentation package.", | ||
@@ -68,4 +68,4 @@ "main": "build/src/index.js", | ||
"dependencies": { | ||
"@opencensus/core": "^0.0.17", | ||
"@opencensus/instrumentation-http": "^0.0.17", | ||
"@opencensus/core": "^0.0.18", | ||
"@opencensus/instrumentation-http": "^0.0.18", | ||
"semver": "^6.0.0", | ||
@@ -72,0 +72,0 @@ "shimmer": "^1.2.0" |
21042
165
+ Added@opencensus/core@0.0.18(transitive)
+ Added@opencensus/instrumentation-http@0.0.18(transitive)
- Removed@opencensus/core@0.0.17(transitive)
- Removed@opencensus/instrumentation-http@0.0.17(transitive)
Updated@opencensus/core@^0.0.18