feat(telemetry/nodejs): add /spawn_child weblog endpoint for session ID header tests#6540
feat(telemetry/nodejs): add /spawn_child weblog endpoint for session ID header tests#6540khanayan123 wants to merge 1 commit intomainfrom
Conversation
Adds the /spawn_child weblog endpoint to the Node.js express4 weblog and the fork_child.js child process script. These support test_session_id_headers_across_forks and test_session_id_headers_across_spawned from the Stable Service Instance Identifier RFC validation suite. - GET /spawn_child?sleep=N&crash=bool&fork=bool - fork=true: uses child_process.fork() (exec-based in Node.js) - fork=false: uses child_process.spawn(process.execPath, ...) - fork_child.js: sleeps N seconds, optionally crashes with SIGSEGV Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac6ae93795
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| #!/usr/bin/env node | ||
| // Child process for spawn_child endpoint. Args: sleep (seconds), crash (true|false). | ||
| const sleepSec = parseInt(process.argv[2] || '2', 10) * 1000 |
There was a problem hiding this comment.
Preload dd-trace in the spawned child process
In the express4/express5/uds-express4 images I checked (utils/build/docker/nodejs/express4.Dockerfile, utils/build/docker/nodejs/express5.Dockerfile, and utils/build/docker/nodejs/app.sh), the weblog is started as node app.js and never sets NODE_OPTIONS/--require dd-trace. Because this child script only sleeps and exits, both the new fork() and spawn() paths will launch an uninstrumented Node process, so the session-ID header tests this endpoint is meant to support will not observe any child telemetry or DD-Session-ID/DD-Root-Session-ID headers on the standard express weblogs.
Useful? React with 👍 / 👎.
Summary
Adds the
/spawn_childweblog endpoint andfork_child.jschild script to the Node.js express4 weblog, supporting the Stable Service Instance Identifier RFC system tests.GET /spawn_child?sleep=N&crash=bool&fork=boolfork=true: spawns child viachild_process.fork()(exec-based in Node.js despite the name)fork=false: spawns child viachild_process.spawn(process.execPath, ...)NODE_OPTIONS(and therefore dd-trace) from parent environmentfork_child.js: minimal child script that sleeps N seconds then exits (or SIGSEGVs if crash=true)Related
Test plan
test_session_id_headers_across_forks— verify DD-Session-ID/DD-Root-Session-ID across forktest_session_id_headers_across_spawned— verify same across exec spawn🤖 Generated with Claude Code