Skip to content

Instantly share code, notes, and snippets.

@GlenTiki
Last active January 26, 2017 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save GlenTiki/c51ed25eb3a5a603cb7e to your computer and use it in GitHub Desktop.
Save GlenTiki/c51ed25eb3a5a603cb7e to your computer and use it in GitHub Desktop.
Hook idea's

What we have: a bunch of global trace events.

Globals:
 LTTNG_NET_SERVER_CONNECTION
 ...
 &&
 DTRACE_NET_SERVER_CONNECTION
 ...

What we need:

Globals:
  NODE_NET_SERVER_CONNECTION
  ...

Where '...' represents the rest of the trace events.

What should happen: With no instrumentation specified at build time, we should have the NODE_TRACE_EVENTS resolve to noops.

When we compile in a tracer system, such as dtrace, or lttng, we should have a back-ended pool which the hooks can hook into.

So when we call NODE_NET_SERVER_CONNECTION it should noop with no tracing enabled, or for example, with Dtrace enabled it should call DTRACE_NET_SERVER_CONNECTION, and then be resolved to the DTRACE hook.

I think the structure for this is fairly simple to implement, we need to pull the generic, replicated code from the node_lttng.cc and node_dtrace.cc files, and make a generic node_tracing.cc file, which the hooks can be compiled into, if enabled. However what we pull and noop will be complex, and I will need guidance with it! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment