Commit 3356abc
docs(configuration): pair threads.preload with preloadRequire for dd-trace (#644)
* docs(configuration): pair threads.preload with preloadRequire for dd-trace
`dd-trace/register.js` only installs the ESM loader hooks; it never calls
`init()`. Configuring `threads.preload: dd-trace/register.js` alone therefore
leaves the tracer uninitialized - spans are created and carry plausible trace
ids, but they are no-ops and nothing is exported, so the failure is silent.
`dd-trace/init` (`threads.preloadRequire`) is the entry that starts the tracer.
Replace the claim that `dd-trace/init` "only covers the main thread", show both
keys together in the dd-trace example, and cross-reference the two bullets.
Behavior is scoped to dd-trace 6.x, since a future major could change
`register.js`.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* docs(configuration): make every dd-trace preload example viable
The multi-module `threads.preload` example still listed `dd-trace/register.js`
under `preload` alone, which reproduces the exact inert-tracer footgun the
single-module example was corrected for: anyone copying it gets a worker whose
tracer is never initialized and which exports no traces. Add
`preloadRequire: dd-trace/init` to that example too.
Also record why `dd-trace/initialize.mjs` is not the simpler single-entry
alternative it looks like. On dd-trace 6.x it gates both its `init()` call and
its `Module.register()` of the loader hook behind `isMainThread`, and its
exported `load`/`resolve` hooks only take effect under `--loader`. Harper
preloads via `--import` in a worker's `execArgv`, so on a worker thread that
entry starts nothing and registers nothing.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* docs(configuration): make threads.preload guidance agent-neutral
The preload/preloadRequire bullets described a specific dd-trace pairing as
if it were a Harper-validated recipe. Reading dd-trace's entry points
establishes what those entries do; it does not establish that Harper's
worker execArgv composition exports spans with usable trace context and
clean shutdown.
Rather than build a Harper end-to-end validation for this, the guidance is
now agent-neutral and dd-trace is described as unverified:
- Both bullets explain the general mechanism - preload uses --import (ESM,
loader hooks), preloadRequire uses --require (CommonJS, runs the module
body) - and note that which entry point does which is agent-specific.
- dd-trace stays as an illustration of the split-entry case, behind an
explicit warning that the values are not a Harper-validated APM
configuration and that the specifics are only what dd-trace's own entries
do as observed in 6.x. Readers are told to confirm spans arrive at their
own collector.
- The register.js-does-not-call-init() pairing detail is kept, scoped as a
dd-trace observation.
- Harper facts are unchanged: bare-specifier resolution against installed
components' node_modules, absolute paths accepted, worker threads only,
not under Bun.
Both dd-trace examples on the page carry the same framing and comments.
Closes #625
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* docs(configuration): split the preload guidance into short bullets plus prose
The preload and preloadRequire bullets had grown to a paragraph each,
sitting in a list whose other entries are one-liners. Trim both to a
sentence and move the mechanism -- --import for loader hooks, --require
for initialization, and why an agent may need both -- into prose under
a new heading.
Drop the warning framing around the dd-trace example. The observed
6.x behavior is stated as what dd-trace does, with a closing reminder
to check the agent's own docs and confirm spans reach the collector,
rather than a block declaring the values unvalidated.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>1 parent d895f42 commit 3356abc
1 file changed
Lines changed: 25 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
69 | 86 | | |
70 | 87 | | |
71 | 88 | | |
72 | | - | |
| 89 | + | |
| 90 | + | |
73 | 91 | | |
74 | 92 | | |
75 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
76 | 96 | | |
77 | 97 | | |
78 | 98 | | |
| 99 | + | |
79 | 100 | | |
80 | 101 | | |
81 | 102 | | |
82 | 103 | | |
83 | 104 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
| 105 | + | |
90 | 106 | | |
91 | 107 | | |
92 | 108 | | |
| |||
0 commit comments