-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Tracing: Add lttng support for tracing on Linux. #702
Conversation
So, this PR goes off without a hike, except there was a failing test - test/sequential/test-util-debug.js |
To build with lttng probes on, you need to have installed lttng as described here: Lttng docs I would like to document this feature, but documentation is lacking on the tracing side of things, so I cannot work from example. How would you guys like for us to document this? |
parser.add_option('--with-lttng', | ||
action='store_true', | ||
dest='with_lttng', | ||
help='build with Lttng (Only available to Linux)') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it default to 'on' on Linux, or will that break Linuxen that don't have LTTNG?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It cannot default to 'on' on Linux as the library won't be accessible to the compiler if its not installed.
The PR more or less LGTM. However:
|
@bnoordhuis How would I just test the style without running Also, some of the TRACEPOINT_EVENT macros will throw style errors as that is the way the macro is supposed to be, without the commas. The duplication I can try to reduce, but I wouldn't be very comfortable with it. |
The issues with style was fixed, I had to add two of the files to the cpplint exclude list in the makefile. Both dtrace and ETW have similar solutions for their files. Trace related code seems to break linters in general. I fixed all the style errors in the files however, the only errors are relating to defined headers and not having a header guard at the top of the file, which I didn't do as that is not the lttng way of doing the tracepoint files. |
On the code duplication, how would you recommend I approach it, so to make it more generic? |
macro LTTNG_HTTP_SERVER_REQUEST(x) = ; | ||
macro LTTNG_HTTP_SERVER_RESPONSE(x) = ; | ||
macro LTTNG_NET_SERVER_CONNECTION(x) = ; | ||
macro LTTNG_NET_STREAM_END(x) = ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed a file ending in the cleanup commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing now... the python files weren't linted. Cheers (Y)
@groundwater you might be interested in this: getting this to a place where the trace endpoint is abstracted rather than duplicated between lttng and dtrace. |
👍 to merge after one last newline nit is fixed. The deduplication seems like it could easily turn into a refactoring into generic tracing points, which makes sense as a separate PR. |
I agree with @rmg, LGTM. |
@trevnorris you mentioned being concerned the trace stubs were getting compiled into a no-op function, but they aren't, they are completely remove by js2c: |
This commit adds the ability to enable userspace tracing with lttng in io.js. It adds tracepoints for all the equivalent dtrace and ETW tracepoints. To use these tracepoints enable --with-lttng on linux.
Okay, I've squashed all the commits. What next? Are we making the generic tracepoints into another PR, as it may break existing Dtrace probes/api? Or should we proceed as @thlorenz said, and make the configure simply remove the noop/tracepoints for compilation? This could be a bigish project/refactor. |
Leave the big-ish ideas for later. We still need to decide what a generic tracepoint API would look like. :) |
|
||
Environment* env = Environment::GetCurrent(args); | ||
HandleScope scope(env->isolate()); | ||
Local<Object> arg0 = Local<Object>::Cast(args[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caveat emptor: Cast() does the wrong thing when someone does this.connection = null
. There should be a if (!args[0]->IsObject()) return
guard a few lines up. You probably want to do it after the NODE_HTTP_SERVER_REQUEST_ENABLED check because that check is presumably cheaper than calling args[0]->IsObject()
.
Side note: you don't need the HandleScope. JS -> C++ callbacks have an implicit HandleScope.
return; | ||
|
||
Environment* env = Environment::GetCurrent(args); | ||
HandleScope scope(env->isolate()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is being called from JS then it doesn't need the HandleScope
.
@thekemkid nice work here. |
@trevnorris @bnoordhuis I did some more work, I'll commit it so you can review. Its unfinished, I haven't fixed the c style casting, and the forwarded_for const char* needs work, I think. |
This commit adds the ability to enable userspace tracing with lttng in io.js. It adds tracepoints for all the equivalent dtrace and ETW tracepoints. To use these tracepoints enable --with-lttng on linux. PR-URL: #702 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ryan Graham <ryan@strongloop.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Landed in 5e825d1, thanks Glen. We can tie up the loose ends later. |
Notable changes: * stream: - Simpler stream construction, see nodejs/readable-stream#102 for details. This extends the streams base objects to make their constructors accept default implementation methods, reducing the boilerplate required to implement custom streams. An updated version of readable-stream will eventually be released to match this change in core. (@sonewman) * dns: - `lookup()` now supports an `'all'` boolean option, default to `false` but when turned on will cause the method to return an array of *all* resolved names for an address, see, #744 (@silverwind) * assert: - Remove `prototype` property comparison in `deepEqual()`, considered a bugfix, see #636 (@vkurchatkin) - Introduce a `deepStrictEqual()` method to mirror `deepEqual()` but performs strict equality checks on primitives, see #639 (@vkurchatkin) * **tracing**: - Add LTTng (Linux Trace Toolkit Next Generation) when compiled with the `--with-lttng` option. Trace points match those available for DTrace and ETW. #702 (@thekemkid) * npm upgrade to 2.5.1 * **libuv** upgrade to 1.4.0 * Add new collaborators: - Aleksey Smolenchuk (@lxe) - Shigeki Ohtsu (@shigeki)
This commit adds the ability to enable userspace tracing with lttng
in io.js. It adds tracepoints for all the equivalent dtrace and ETW
tracepoints. To use these tracepoints enable --with-lttng on linux.