diagnostics_channel: add USDT probes - #62118
Conversation
|
Review requested:
|
|
|
||
| #### Platform support | ||
|
|
||
| At `./configure` time, Node.js checks for a working `dtrace` tool and |
There was a problem hiding this comment.
We have removed dtrace support long time ago. Wouldn't it require us to include a new suite for testing it on that environment?
There was a problem hiding this comment.
I'm not sure what our build setup looks like now, but yes, everything that was required for the previous incarnation of probes in Node.js would likely be required again with this PR.
There was a problem hiding this comment.
I don't think we tested the dtrace stuff previously. I think when it was removed it had be broken for a while (or maybe that was one of the other non-tested removed features).
There was a problem hiding this comment.
There's a possible path forward here where headers are pre-generated and added to git (much like we do for other cases of generated headers, in dependencies for example), and then a userland, self-contained test (at least on linux) checks for the placement and activation of the probe.
There was a problem hiding this comment.
Alright, I've made some changes (many months later..)
Linux is now default-on with no dtrace build dependency. src/node_provider_linux.h is committed.
It can be regenerated via tools/usdt/generate_headers.py and a --check drift job runs in CI against it.
Default ./configure enables USDT whenever <sys/sdt.h> is present (systemtap-sdt-dev / systemtap-sdt-devel is the only build requirement on Linux).
macOS is opt-in via ./configure --with-dtrace (which at build-time calls dtrace -h -xnolibs).
--without-dtrace still disables everything.
New test-usdt CI job in test-linux.yml:
- default: end-to-end bpftrace test as root (verifies the probe fires with the channel name) plus the committed-header drift check
--without-dtrace: pins the no-op tier
Bench (aarch64 VM, benchmark/diagnostics_channel/publish.js, subscribers=1, avg of 2): default ~282M ops/s vs --without-dtrace ~314M ops/s — ~10% on this microbench.
|
This pull request has been marked as stale due to 90 days of inactivity. |
Implements the approach from the nodejs#62118 review discussion to remove the build-time 'dtrace' dependency on Linux: * Commit the SystemTap-generated probe header (src/node_provider_linux.h, regenerate with tools/usdt/generate_headers.py). USDT support is now on by default on Linux whenever <sys/sdt.h> is available (systemtap-sdt-dev on Debian/Ubuntu, systemtap-sdt-devel on Fedora/RHEL) and never needs a 'dtrace' tool at build time. A committed-header drift check runs in CI. * Make native DTrace opt-in on macOS via the new ./configure --with-dtrace; FreeBSD/illumos remain unsupported pending a 'dtrace -G' link step. --without-dtrace still disables probes everywhere. The always-on <sys/sdt.h> fallback tier is gone. * Add a path-gated test-usdt job to the Linux CI workflow with a default leg that runs the end-to-end bpftrace probe test as root, and a --without-dtrace leg that pins the no-op tier. The generated header is excluded from cpplint like src/node_root_certs.h.
Adds USDT probes that are fired for every diagnostics_channel publish. Signed-off-by: Bryan English <bryan@bryanenglish.com>
Implements the approach from the nodejs#62118 review discussion to remove the build-time 'dtrace' dependency on Linux: * Commit the SystemTap-generated probe header (src/node_provider_linux.h, regenerate with tools/usdt/generate_headers.py). USDT support is now on by default on Linux whenever <sys/sdt.h> is available (systemtap-sdt-dev on Debian/Ubuntu, systemtap-sdt-devel on Fedora/RHEL) and never needs a 'dtrace' tool at build time. A committed-header drift check runs in CI. * Make native DTrace opt-in on macOS via the new ./configure --with-dtrace; FreeBSD/illumos remain unsupported pending a 'dtrace -G' link step. --without-dtrace still disables probes everywhere. The always-on <sys/sdt.h> fallback tier is gone. * Add a path-gated test-usdt job to the Linux CI workflow with a default leg that runs the end-to-end bpftrace probe test as root, and a --without-dtrace leg that pins the no-op tier. The generated header is excluded from cpplint like src/node_root_certs.h. Signed-off-by: Bryan English <bryan@bryanenglish.com>
The publish() hot path captured the probe semaphore Uint16Array view at module load. This module is baked into the startup snapshot, and the view's native backing store cannot be serialized: the captured view is detached when the snapshot is deserialized, so publish() never called emitPublishProbe() in snapshot builds and the dc__publish probe never fired for JavaScript publishes even with a tracer attached. Caught by the new bpftrace CI job. Resolve the view lazily from the binding (once per process; 'null' marks a USDT-less build) and add positive-path coverage to test-diagnostics-channel-usdt.js: force the semaphore and verify that publish() calls emitPublishProbe() for string-named channels, never for symbol-named ones, and not when the semaphore is 0. Signed-off-by: Bryan English <bryan@bryanenglish.com>
Adds USDT probes that are fired for every diagnostics_channel publish.