Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: patch https in Node 8.9 and 9.0 #591

Merged
merged 4 commits into from
Nov 13, 2017
Merged

src: patch https in Node 8.9 and 9.0 #591

merged 4 commits into from
Nov 13, 2017

Conversation

kjin
Copy link
Contributor

@kjin kjin commented Nov 7, 2017

Fixes #589

Loading either http or https will cause both to be patched for tracing. This is in line with behavior in <8.9, as https.request used to depend on http.request.

The only new user-facing change is in the addition of the https config field: disabling causes the specific behavior of not patching https only if it's loaded before http in user-space code. It's a niche use-case so I think this is justifiable, but please let me know your thoughts.

By nature of our loader system this is uncharted territory, so feel free to give suggestions if you think there's a better approach.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 7, 2017
@@ -164,6 +164,7 @@ export const defaultConfig = {
'grpc': path.join(__dirname, 'src/plugins/plugin-grpc.js'),
'hapi': path.join(__dirname, 'src/plugins/plugin-hapi.js'),
'http': path.join(__dirname, 'src/plugins/plugin-http.js'),
'https': path.join(__dirname, 'src/plugins/plugin-https.js'),

This comment was marked as spam.

This comment was marked as spam.

@kjin
Copy link
Contributor Author

kjin commented Nov 8, 2017

@kjin
Copy link
Contributor Author

kjin commented Nov 8, 2017

@ofrobots @GoogleCloudPlatform/node-team PTAL when AppVeyor CI is green.


module.exports = [];

export default {};

This comment was marked as spam.

This comment was marked as spam.

// https depends on http anyway, so this shouldn't cause an unnecessary load.
require('http');

module.exports = [];

This comment was marked as spam.

This comment was marked as spam.

!!options.headers[api.constants.TRACE_AGENT_REQUEST_HEADER];
}

function makeRequestTrace(request, api) {

This comment was marked as spam.

This comment was marked as spam.

@kjin kjin changed the title src: patch https in Node 8.9+ src: patch https in Node 8.9 and 9.0 Nov 9, 2017
return request.apply(this, arguments);
}
function patchHttps(https, api) {
console.log('patch https');

This comment was marked as spam.

This comment was marked as spam.

shimmer.wrap(https, 'request', function requestWrap(request) {
return makeRequestTrace(request, api);
});
shimmer.wrap(https, 'get', function requestWrap(get) {

This comment was marked as spam.

This comment was marked as spam.

@kjin kjin merged commit 4170f89 into googleapis:master Nov 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants