Skip to content

Add standalone datadog-ipc-helper binary#3713

Draft
cataphract wants to merge 13 commits intomasterfrom
glopes/standalone-sidecar
Draft

Add standalone datadog-ipc-helper binary#3713
cataphract wants to merge 13 commits intomasterfrom
glopes/standalone-sidecar

Conversation

@cataphract
Copy link
Contributor

Extract the sidecar into a dedicated datadog-ipc-helper binary (new components-rs/sidecar-bin crate) that is located at runtime alongside the ddtrace.so path, removing the php_shared_build cfg flag and the old php_sidecar_mockgen crate entirely.

Build script gains platform specific RUSTFLAGS for the sidecar binary: musl disables static CRT (needed for dlopen of the AppSec helper) and mac os switches fat LTO to thin LTO to work around problems with the llvm mac os linker.

Description

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

Extract the sidecar into a dedicated `datadog-ipc-helper` binary (new
`components-rs/sidecar-bin` crate) that is located at runtime alongside
the `ddtrace.so` path, removing the `php_shared_build` cfg flag and the
old `php_sidecar_mockgen` crate entirely.

Build script gains platform specific RUSTFLAGS for the sidecar binary:
musl disables static CRT (needed for dlopen of the AppSec helper) and
mac os switches fat LTO to thin LTO to work around problems with the
llvm mac os linker.
@codecov-commenter
Copy link

codecov-commenter commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 22.52252% with 86 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.38%. Comparing base (f4ce0bf) to head (051246c).
⚠️ Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
appsec/helper-rust/src/ffi.rs 0.00% 63 Missing ⚠️
appsec/src/helper/service.cpp 31.25% 11 Missing ⚠️
appsec/helper-rust/src/telemetry/sidecar.rs 54.54% 5 Missing ⚠️
appsec/src/helper/runner.cpp 0.00% 5 Missing ⚠️
appsec/helper-rust/src/rc_notify.rs 86.66% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3713      +/-   ##
==========================================
- Coverage   68.74%   68.38%   -0.36%     
==========================================
  Files         166      166              
  Lines       19030    18940      -90     
  Branches     1797     1794       -3     
==========================================
- Hits        13082    12953     -129     
- Misses       5132     5174      +42     
+ Partials      816      813       -3     
Flag Coverage Δ
helper-rust-integration 79.15% <73.07%> (+0.32%) ⬆️
helper-rust-unit 48.52% <0.00%> (-0.85%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
appsec/src/helper/ffi.hpp 0.00% <ø> (-67.75%) ⬇️
appsec/src/helper/remote_config/client.cpp 14.55% <100.00%> (ø)
appsec/helper-rust/src/rc_notify.rs 75.00% <86.66%> (-2.91%) ⬇️
appsec/helper-rust/src/telemetry/sidecar.rs 78.16% <54.54%> (-0.95%) ⬇️
appsec/src/helper/runner.cpp 0.00% <0.00%> (ø)
appsec/src/helper/service.cpp 48.07% <31.25%> (+0.20%) ⬆️
appsec/helper-rust/src/ffi.rs 0.00% <0.00%> (-74.49%) ⬇️

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f4ce0bf...051246c. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pr-commenter
Copy link

pr-commenter bot commented Mar 19, 2026

Benchmarks [ tracer ]

Benchmark execution time: 2026-03-19 19:50:28

Comparing candidate commit 3fbbd84 in PR branch glopes/standalone-sidecar with baseline commit f4ce0bf in branch master.

Found 2 performance improvements and 0 performance regressions! Performance is the same for 191 metrics, 1 unstable metrics.

scenario:ComposerTelemetryBench/benchTelemetryParsing

  • 🟩 execution_time [-1297.400ns; -502.600ns] or [-11.584%; -4.488%]

scenario:MessagePackSerializationBench/benchMessagePackSerialization

  • 🟩 execution_time [-4.366µs; -2.394µs] or [-4.096%; -2.246%]

@datadog-official
Copy link

datadog-official bot commented Mar 19, 2026

⚠️ Tests

Fix all issues with BitsAI or with Cursor

⚠️ Warnings

🧪 13 Tests failed

testSearchPhpBinaries from integration.DDTrace\Tests\Integration\PHPInstallerTest (Datadog) (Fix with Cursor)
DDTrace\Tests\Integration\PHPInstallerTest::testSearchPhpBinaries
Test code or tested code printed unexpected output: Searching for available php binaries, this operation might take a while.

phpvfscomposer://tests/vendor/phpunit/phpunit/phpunit:106
testSimplePushAndProcess from laravel-58-test.DDTrace\Tests\Integrations\Laravel\V5_8\QueueTest (Datadog) (Fix with Cursor)
DDTrace\Tests\Integrations\Laravel\V5_8\QueueTest::testSimplePushAndProcess
Test code or tested code printed unexpected output: spanLinksTraceId: 69bde36700000000515cb8eb84b51711
tid: 69bde36700000000
hexProcessTraceId: 515cb8eb84b51711
hexProcessSpanId: 537b9cf65234a674
processTraceId: 5862764136612828945
processSpanId: 6015574309038499444

phpvfscomposer://tests/vendor/phpunit/phpunit/phpunit:106
testSimplePushAndProcess from laravel-8x-test.DDTrace\Tests\Integrations\Laravel\V8_x\QueueTest (Datadog) (Fix with Cursor)
DDTrace\Tests\Integrations\Laravel\V8_x\QueueTest::testSimplePushAndProcess
Test code or tested code printed unexpected output: spanLinksTraceId: 69bde39c00000000e95d2a8fea7713f9
tid: 69bde39c00000000
hexProcessTraceId: e95d2a8fea7713f9
hexProcessSpanId: cd00b5b8ba1c7bba
processTraceId: 16815643381273662457
processSpanId: 14772006582776265658

phpvfscomposer://tests/vendor/phpunit/phpunit/phpunit:106
View all

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 051246c | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@cataphract cataphract force-pushed the glopes/standalone-sidecar branch 3 times, most recently from 8053291 to 2003030 Compare March 20, 2026 12:13
@cataphract cataphract force-pushed the glopes/standalone-sidecar branch from 2003030 to f85a1a0 Compare March 20, 2026 12:34
cataphract and others added 6 commits March 20, 2026 13:02
find_sidecar_binary() locates datadog-ipc-helper relative to ddtrace.so via
dladdr. The appsec extension xtest build (cmake) only runs the inner PHP
Makefile, never the outer repo Makefile's all target, so the outer Makefile's
$(SIDECAR_BIN_IN_MODULES) copy rule never fires. Copying in compile_rust.sh
ensures the binary lands next to ddtrace.so in every build path.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
In the cmake appsec test build, extension_dir contains a symlink
ddtrace.so → tmp/build_extension/modules/ddtrace.so.  dladdr may return
the symlink path rather than the real path.  Canonicalizing ensures
find_sidecar_binary() always looks in the directory where the real
ddtrace.so lives, where we already copy datadog-ipc-helper.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
CI test jobs download pre-built ddtrace.so without running cargo, so
SIDECAR_BIN doesn't exist in those contexts.  Making the ipc-helper copy
in the install target conditional on the binary existing prevents make
from failing when it's not present.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Previously the script called sys.exit(1) as soon as any job failed,
leaving hundreds of still-running jobs unreported.  Now it waits for
running==0 before exiting so the final failure list is complete.

Also document in CLAUDE.md that conclusions must not be drawn until
running==0, and that Haiku agents need a long enough Bash timeout.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
compile_rust.sh: only copy datadog-ipc-helper when CARGO_TARGET_DIR is
absolute.  build-sidecar.sh uses a relative 'target' dir and doesn't
need the binary placed in modules/; the unconditional cp was failing
because cargo's output is relative to the workspace root (one level
above components-rs/) while cp was called from inside components-rs/.

libdatadog: add IntoRawHandle to spawn_worker Windows imports so that
into_raw_handle() is in scope on Windows builds.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@cataphract cataphract force-pushed the glopes/standalone-sidecar branch from 05aa5d1 to 46aad4b Compare March 20, 2026 17:33
cataphract and others added 5 commits March 20, 2026 18:12
compile extension: move datadog-ipc-helper to modules/{version}/ in
after_script so it travels with ddtrace.so as a CI artifact.

test jobs: also mv datadog-ipc-helper to tmp/build_extension/modules/
so make install can find it at SIDECAR_BIN_IN_MODULES.

Makefile install: try SIDECAR_BIN_IN_MODULES first (populated by both
compile_rust.sh and the artifact mv step), falling back to SIDECAR_BIN
(built from source).

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
build-sidecar.sh: produce datadog-ipc-helper${arch}[${suffix}] alongside
libddtrace_php artifacts.

generate-package.php: include datadog-ipc-helper* in build-sidecar
artifact paths so link-tracing-extension can pick it up.

link-tracing-extension.sh: copy datadog-ipc-helper into extensions_arch/
so it travels with ddtrace.so into installer packages (.deb/.rpm/.apk)
and the verify tests (/opt/datadog-php/extensions/).

generate-ssi-package.sh: copy datadog-ipc-helper into the SSI loader/
directory alongside libddtrace_php.so.

generate-final-artifact.sh: copy datadog-ipc-helper into each
ext/$php_api/ directory so it sits next to ddtrace.so in the
dd-library-php bundle.

ffi.rs: run rustfmt to fix formatting check failure.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
rc_notify.rs: rustfmt to fix cargo fmt check.

datadog-setup.php: copy datadog-ipc-helper to the PHP extension
directory alongside ddtrace.so.  The installer copies ddtrace.so from
trace/ext/{api}/ to the system PHP ext dir; find_sidecar_binary() then
looks for datadog-ipc-helper in that same directory.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…n compile_extension.sh

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…nt paths

Without export, compile_rust.sh never sees the variable and cargo defaults
to the workspace-root target/, but compile_extension.sh's link step used the
local variable value — path mismatch broke the link step.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants