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

Adding foundation for dtrace probe support #959

Merged
merged 15 commits into from
Jul 18, 2013
Merged

Conversation

geek
Copy link
Member

@geek geek commented Jul 11, 2013

No description provided.

@@ -0,0 +1,44 @@
// Load modules

var DTraceProvider = require('dtrace-provider');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use conditional load like Restify:

https://github.com/mcavage/node-restify/blob/master/lib/dtrace.js

@hueniverse
Copy link
Contributor

Looks fine for a first pass.

@geek
Copy link
Member Author

geek commented Jul 15, 2013

Related: #972

@hueniverse
Copy link
Contributor

I'm not sure this is sufficiently abstracted to not have any performance impact when dtrace is not used. Needs to turn the exported interface into empty functions so v8 will inline them everywhere called.

@@ -436,11 +436,13 @@ internals.Request.bindPre = function (pre) {
request.pre[pre.assign] = result;
}

request.server._dtrace['pre.end'](pre.assign, result);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want this to become an empty operation. It still makes a function call with some logic.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently it will end up calling function () {} (https://github.com/spumko/hapi/pull/959/files#L0R37)

Would you rather this becomes a conditional call:

request.server._dtrace && request.server._dtrace['pre.end'](pre.assign, result);

where _dtrace is undefined when dtrace-provider is not installed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More like:

request.server._dtrace.report('pre.end', pre.assign, result);

Where report() is an empty function when not enabled.

};


internals.DTrace.prototype.report = function (key, args) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

args is?? If I have to build an array or object, that's bad.

internals.DTrace.prototype.report = function (key/* arg1, arg2 */) {

var args = arguments;
this._probes[key].fire(function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not create probes on first use?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They will only be created when dtrace-provider is installed. In which case, if we create a probe on first use then that may lead to additional overhead after the server has started, versus initializing during the startup.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the idea of having to manage this list in one place, and every time we add a probe also register it here. How slow is creating probes? What about user-defined probes?

hueniverse pushed a commit that referenced this pull request Jul 18, 2013
Adding foundation for dtrace probe support
@hueniverse hueniverse merged commit 81b47a6 into hapijs:master Jul 18, 2013
jmonster pushed a commit to jmonster/hapi that referenced this pull request Feb 10, 2014
Adding foundation for dtrace probe support
@lock lock bot locked as resolved and limited conversation to collaborators Jan 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New functionality or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants