-
Notifications
You must be signed in to change notification settings - Fork 78
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
Trace module WIP - Request for feedback #50
Comments
@joshgav I like the pub/sub broker design, and the support for JS and native. You mention filtering in the brokers, I am wondering how the trace flow is controlled. Say I write a listener and I am interested in trace from a couple of specific modules (and maybe v8 GC trace - see below). How do I enable trace in those modules and filter out trace from other modules that I'm not interested in? Does integration with trace-event allow us to capture the output that's currently produced by v8 under the various/numerous --trace options? I guess that's a v8 question really, I have not worked out if/how those traces are connected with the trace-event API. |
should this remain open? [ I am trying to chase dormant issues to closure ] |
This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made. |
Can be closed, too dated to be of use. Thanks! |
joshgav/node-trace
Hi all. I've started designing and implementing a trace module/system for Node and wanted to get your early feedback. The goal for this module is to provide a common way for native and JS module authors to publish and/or subscribe to trace events both for debugging and logging; and to enable publishing traces back and forth to listeners on both sides of the native/JS boundary.
This could integrate with core TRACE_EVENT work in addition to ecosystem modules; for example, the TRACE_EVENT system could publish to the trace module to route traces to registered listeners. In fact I already implemented that elsewhere as a proof of concept.
Architecture
For now a whiteboard of the design follows; I'll work on something more formal.
Green outlines are JS modules; blue outlines are native artifacts. Black arrows show the flow of a trace published by a JS module; red arrows show the flow of a trace published by a native module or internal component.
The central classes are the native and JS
TraceBroker
classes (in the middle column), which receive published traces and publish them to a list of listeners they maintain. In both JS and C++ publishers callTrace/trace
orTraceNextTick/traceNextTick
to publish a trace. Listeners are function pointers registered viaTraceBroker::RegisterListener
in C++ and functions registered viaEventEmitter.on
in JS.The JS
TraceBroker
class inherits fromevents.EventEmitter
to handle listener management and event publication.The native and JS brokers are wired together through the private
DispatchJSFromNative
and_dispatchNativeFromJS
functions respectively.The example (in
./examples
) works and demonstrates the concept of a trace flowing from JS to both JS and native, try the following:But much work remains; tasks next on my list include the following:
ASK: What do you think of the design? What concerns, e.g. perf, should I be thinking about? What similar modules or attempts exist which I could learn from or work with? And of course contributions are welcome :)
The text was updated successfully, but these errors were encountered: