Skip to content

feat(sidecar): add thread mode as fallback connection for restricted environments#1447

Open
Leiyks wants to merge 13 commits intomainfrom
leiyks/sidecar-threaded-fallback
Open

feat(sidecar): add thread mode as fallback connection for restricted environments#1447
Leiyks wants to merge 13 commits intomainfrom
leiyks/sidecar-threaded-fallback

Conversation

@Leiyks
Copy link
Contributor

@Leiyks Leiyks commented Jan 14, 2026

What does this PR do?

Implements a thread-based sidecar connection mode as an alternative to the existing subprocess mode. When enabled, the sidecar runs as a Tokio thread within the PHP process rather than as a separate subprocess.

Key implementation details:

  • New thread connection mode alongside existing subprocess mode
  • Uses an abstract Unix socket (Linux) or named pipe (Windows) for IPC between the PHP-FPM master thread listener and worker processes
  • The master UID is encoded in the socket/pipe name to support cross-user scenarios (e.g. FPM master as root, workers as www-data)
  • SHM open mode is configurable via a global hook (set_shm_open_mode) to support cross-user shared memory access via fchown/SO_PEERCRED
  • Orphan promotion: if the master's thread listener is unavailable, a worker can promote itself to master
  • Uses current_thread Tokio runtime to avoid spawning additional OS threads beyond the single listener thread
  • Windows support via named pipes (where subprocess mode had limitations)

How to test the change?

Tested via the dd-trace-php integration test suite:

  • SidecarThreadModeTest: verifies multi-request tracing works in thread mode
  • SidecarThreadModeRootTest: verifies cross-user SHM access when FPM master runs as root
  • .phpt unit tests for connection mode configuration and auto-fallback behavior

@codecov-commenter
Copy link

codecov-commenter commented Jan 14, 2026

Codecov Report

❌ Patch coverage is 5.44747% with 243 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.94%. Comparing base (c8a4b19) to head (e93220a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1447      +/-   ##
==========================================
- Coverage   71.17%   70.94%   -0.23%     
==========================================
  Files         429      430       +1     
  Lines       63503    63771     +268     
==========================================
+ Hits        45198    45245      +47     
- Misses      18305    18526     +221     
Components Coverage Δ
libdd-crashtracker 62.39% <ø> (+0.04%) ⬆️
libdd-crashtracker-ffi 17.18% <ø> (+0.61%) ⬆️
libdd-alloc 98.77% <ø> (ø)
libdd-data-pipeline 87.84% <ø> (-0.35%) ⬇️
libdd-data-pipeline-ffi 75.48% <ø> (-0.49%) ⬇️
libdd-common 79.73% <ø> (ø)
libdd-common-ffi 73.40% <ø> (ø)
libdd-telemetry 62.48% <ø> (ø)
libdd-telemetry-ffi 16.75% <ø> (ø)
libdd-dogstatsd-client 82.64% <ø> (ø)
datadog-ipc 80.29% <58.33%> (-0.07%) ⬇️
libdd-profiling 81.60% <ø> (+0.01%) ⬆️
libdd-profiling-ffi 63.65% <ø> (ø)
datadog-sidecar 31.81% <2.85%> (-0.68%) ⬇️
datdog-sidecar-ffi 9.39% <0.00%> (+1.58%) ⬆️
spawn-worker 54.69% <ø> (ø)
libdd-tinybytes 93.16% <ø> (ø)
libdd-trace-normalization 81.71% <ø> (ø)
libdd-trace-obfuscation 91.80% <ø> (ø)
libdd-trace-protobuf 68.25% <ø> (ø)
libdd-trace-utils 88.98% <ø> (-0.11%) ⬇️
datadog-tracer-flare 88.28% <ø> (-2.17%) ⬇️
libdd-log 74.69% <ø> (ø)
🚀 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.

@Leiyks Leiyks force-pushed the leiyks/sidecar-threaded-fallback branch from df12cb3 to 917aceb Compare January 14, 2026 14:11
@pr-commenter
Copy link

pr-commenter bot commented Jan 14, 2026

Benchmarks

Comparison

Benchmark execution time: 2026-03-11 16:41:05

Comparing candidate commit e93220a in PR branch leiyks/sidecar-threaded-fallback with baseline commit c8a4b19 in branch main.

Found 4 performance improvements and 12 performance regressions! Performance is the same for 42 metrics, 2 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:credit_card/is_card_number/ 378282246310005

  • 🟥 execution_time [+5.024µs; +5.076µs] or [+7.396%; +7.473%]
  • 🟥 throughput [-1023753.770op/s; -1013770.097op/s] or [-6.954%; -6.886%]

scenario:credit_card/is_card_number/378282246310005

  • 🟥 execution_time [+5.250µs; +5.295µs] or [+8.114%; +8.183%]
  • 🟥 throughput [-1169000.473op/s; -1159622.669op/s] or [-7.565%; -7.504%]

scenario:credit_card/is_card_number/37828224631000521389798

  • 🟥 execution_time [+6.474µs; +6.505µs] or [+14.162%; +14.229%]
  • 🟥 throughput [-2726532.002op/s; -2712176.187op/s] or [-12.464%; -12.399%]

scenario:credit_card/is_card_number/x371413321323331

  • 🟩 execution_time [-733.663ns; -718.195ns] or [-11.068%; -10.835%]
  • 🟩 throughput [+18347669.905op/s; +18787534.565op/s] or [+12.162%; +12.453%]

scenario:credit_card/is_card_number_no_luhn/ 378282246310005

  • 🟥 execution_time [+4.121µs; +4.158µs] or [+7.712%; +7.781%]
  • 🟥 throughput [-1351075.657op/s; -1339755.673op/s] or [-7.219%; -7.159%]

scenario:credit_card/is_card_number_no_luhn/378282246310005

  • 🟥 execution_time [+4.601µs; +4.653µs] or [+9.163%; +9.267%]
  • 🟥 throughput [-1688716.235op/s; -1671302.310op/s] or [-8.480%; -8.393%]

scenario:credit_card/is_card_number_no_luhn/37828224631000521389798

  • 🟥 execution_time [+6.484µs; +6.513µs] or [+14.182%; +14.245%]
  • 🟥 throughput [-2728859.450op/s; -2715351.523op/s] or [-12.476%; -12.414%]

scenario:credit_card/is_card_number_no_luhn/x371413321323331

  • 🟩 execution_time [-730.937ns; -715.534ns] or [-11.030%; -10.798%]
  • 🟩 throughput [+18282849.368op/s; +18720315.686op/s] or [+12.115%; +12.405%]

Candidate

Candidate benchmark details

Group 1

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
benching serializing traces from their internal representation to msgpack execution_time 13.741ms 13.788ms ± 0.025ms 13.785ms ± 0.013ms 13.798ms 13.815ms 13.889ms 13.995ms 1.52% 3.508 23.186 0.18% 0.002ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
benching serializing traces from their internal representation to msgpack execution_time [13.784ms; 13.791ms] or [-0.026%; +0.026%] None None None

Group 2

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... execution_time 493.286µs 494.264µs ± 0.719µs 494.181µs ± 0.311µs 494.538µs 494.955µs 495.313µs 502.497µs 1.68% 7.555 84.176 0.15% 0.051µs 1 200
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... throughput 1990060.532op/s 2023214.883op/s ± 2911.074op/s 2023550.758op/s ± 1271.874op/s 2024641.803op/s 2025967.365op/s 2026838.707op/s 2027223.129op/s 0.18% -7.429 82.269 0.14% 205.844op/s 1 200
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて execution_time 370.104µs 370.909µs ± 0.326µs 370.884µs ± 0.240µs 371.136µs 371.410µs 371.529µs 372.646µs 0.48% 0.767 2.832 0.09% 0.023µs 1 200
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて throughput 2683512.279op/s 2696082.932op/s ± 2366.645op/s 2696262.406op/s ± 1741.895op/s 2697846.183op/s 2699243.294op/s 2700500.078op/s 2701945.142op/s 0.21% -0.756 2.775 0.09% 167.347op/s 1 200
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters execution_time 167.275µs 167.570µs ± 0.131µs 167.550µs ± 0.086µs 167.671µs 167.796µs 167.873µs 167.898µs 0.21% 0.373 -0.535 0.08% 0.009µs 1 200
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters throughput 5956008.643op/s 5967670.121op/s ± 4677.490op/s 5968365.995op/s ± 3074.613op/s 5971167.938op/s 5974438.657op/s 5976176.783op/s 5978172.164op/s 0.16% -0.370 -0.537 0.08% 330.748op/s 1 200
normalization/normalize_service/normalize_service/[empty string] execution_time 37.168µs 37.263µs ± 0.039µs 37.259µs ± 0.026µs 37.286µs 37.335µs 37.368µs 37.390µs 0.35% 0.532 0.461 0.11% 0.003µs 1 200
normalization/normalize_service/normalize_service/[empty string] throughput 26744989.342op/s 26836225.974op/s ± 28258.968op/s 26839266.695op/s ± 18523.154op/s 26856976.353op/s 26871532.720op/s 26895685.296op/s 26904610.412op/s 0.24% -0.525 0.452 0.11% 1998.211op/s 1 200
normalization/normalize_service/normalize_service/test_ASCII execution_time 45.361µs 45.623µs ± 0.135µs 45.629µs ± 0.110µs 45.729µs 45.805µs 45.851µs 46.282µs 1.43% 0.433 1.333 0.29% 0.010µs 1 200
normalization/normalize_service/normalize_service/test_ASCII throughput 21606672.140op/s 21918913.566op/s ± 64657.027op/s 21916076.329op/s ± 52808.425op/s 21969249.037op/s 22019191.953op/s 22031022.766op/s 22045126.374op/s 0.59% -0.406 1.204 0.29% 4571.942op/s 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... execution_time [494.164µs; 494.364µs] or [-0.020%; +0.020%] None None None
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... throughput [2022811.437op/s; 2023618.330op/s] or [-0.020%; +0.020%] None None None
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて execution_time [370.864µs; 370.954µs] or [-0.012%; +0.012%] None None None
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて throughput [2695754.938op/s; 2696410.926op/s] or [-0.012%; +0.012%] None None None
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters execution_time [167.551µs; 167.588µs] or [-0.011%; +0.011%] None None None
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters throughput [5967021.866op/s; 5968318.377op/s] or [-0.011%; +0.011%] None None None
normalization/normalize_service/normalize_service/[empty string] execution_time [37.258µs; 37.269µs] or [-0.015%; +0.015%] None None None
normalization/normalize_service/normalize_service/[empty string] throughput [26832309.553op/s; 26840142.395op/s] or [-0.015%; +0.015%] None None None
normalization/normalize_service/normalize_service/test_ASCII execution_time [45.604µs; 45.642µs] or [-0.041%; +0.041%] None None None
normalization/normalize_service/normalize_service/test_ASCII throughput [21909952.724op/s; 21927874.408op/s] or [-0.041%; +0.041%] None None None

Group 3

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
receiver_entry_point/report/2598 execution_time 3.425ms 3.455ms ± 0.023ms 3.449ms ± 0.008ms 3.459ms 3.500ms 3.545ms 3.567ms 3.41% 2.441 7.051 0.66% 0.002ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
receiver_entry_point/report/2598 execution_time [3.452ms; 3.458ms] or [-0.092%; +0.092%] None None None

Group 4

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
tags/replace_trace_tags execution_time 2.403µs 2.429µs ± 0.013µs 2.428µs ± 0.006µs 2.433µs 2.463µs 2.470µs 2.495µs 2.76% 1.719 4.500 0.55% 0.001µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
tags/replace_trace_tags execution_time [2.428µs; 2.431µs] or [-0.077%; +0.077%] None None None

Group 5

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
concentrator/add_spans_to_concentrator execution_time 10.724ms 10.758ms ± 0.015ms 10.757ms ± 0.009ms 10.765ms 10.782ms 10.797ms 10.824ms 0.62% 0.781 1.660 0.13% 0.001ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
concentrator/add_spans_to_concentrator execution_time [10.756ms; 10.760ms] or [-0.019%; +0.019%] None None None

Group 6

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
two way interface execution_time 17.613µs 25.396µs ± 9.655µs 18.082µs ± 0.326µs 33.872µs 43.826µs 46.966µs 68.899µs 281.03% 1.033 0.762 37.92% 0.683µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
two way interface execution_time [24.058µs; 26.734µs] or [-5.269%; +5.269%] None None None

Group 7

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
ip_address/quantize_peer_ip_address_benchmark execution_time 5.109µs 5.188µs ± 0.051µs 5.161µs ± 0.013µs 5.236µs 5.280µs 5.282µs 5.286µs 2.41% 0.708 -1.043 0.99% 0.004µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
ip_address/quantize_peer_ip_address_benchmark execution_time [5.181µs; 5.195µs] or [-0.137%; +0.137%] None None None

Group 8

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
benching deserializing traces from msgpack to their internal representation execution_time 49.975ms 50.300ms ± 0.917ms 50.170ms ± 0.057ms 50.227ms 50.448ms 53.671ms 58.967ms 17.53% 8.366 73.074 1.82% 0.065ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
benching deserializing traces from msgpack to their internal representation execution_time [50.173ms; 50.427ms] or [-0.253%; +0.253%] None None None

Group 9

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
credit_card/is_card_number/ execution_time 3.895µs 3.912µs ± 0.003µs 3.912µs ± 0.002µs 3.914µs 3.917µs 3.918µs 3.919µs 0.18% -0.863 6.338 0.07% 0.000µs 1 200
credit_card/is_card_number/ throughput 255150813.389op/s 255608883.610op/s ± 179212.887op/s 255604110.211op/s ± 106872.576op/s 255719786.329op/s 255852495.763op/s 255929240.440op/s 256723531.046op/s 0.44% 0.879 6.438 0.07% 12672.265op/s 1 200
credit_card/is_card_number/ 3782-8224-6310-005 execution_time 79.442µs 79.777µs ± 0.190µs 79.734µs ± 0.133µs 79.891µs 80.125µs 80.313µs 80.526µs 0.99% 0.954 1.408 0.24% 0.013µs 1 200
credit_card/is_card_number/ 3782-8224-6310-005 throughput 12418383.623op/s 12534953.140op/s ± 29856.850op/s 12541728.624op/s ± 20984.931op/s 12556641.291op/s 12574424.879op/s 12581618.790op/s 12587772.238op/s 0.37% -0.936 1.344 0.24% 2111.198op/s 1 200
credit_card/is_card_number/ 378282246310005 execution_time 72.578µs 72.973µs ± 0.173µs 72.965µs ± 0.100µs 73.067µs 73.231µs 73.457µs 73.705µs 1.01% 0.723 2.080 0.24% 0.012µs 1 200
credit_card/is_card_number/ 378282246310005 throughput 13567658.347op/s 13703717.143op/s ± 32462.048op/s 13705251.167op/s ± 18804.290op/s 13722331.723op/s 13753828.911op/s 13772563.395op/s 13778347.819op/s 0.53% -0.698 2.002 0.24% 2295.413op/s 1 200
credit_card/is_card_number/37828224631 execution_time 3.894µs 3.913µs ± 0.004µs 3.913µs ± 0.002µs 3.915µs 3.918µs 3.923µs 3.928µs 0.38% -0.156 5.123 0.09% 0.000µs 1 200
credit_card/is_card_number/37828224631 throughput 254591483.223op/s 255568585.301op/s ± 229160.266op/s 255558803.761op/s ± 146430.744op/s 255727145.454op/s 255885396.647op/s 255961653.487op/s 256813956.216op/s 0.49% 0.175 5.164 0.09% 16204.078op/s 1 200
credit_card/is_card_number/378282246310005 execution_time 69.699µs 69.982µs ± 0.151µs 69.955µs ± 0.094µs 70.079µs 70.262µs 70.433µs 70.527µs 0.82% 0.820 0.509 0.22% 0.011µs 1 200
credit_card/is_card_number/378282246310005 throughput 14178975.356op/s 14289360.781op/s ± 30789.863op/s 14294803.840op/s ± 19213.163op/s 14312914.901op/s 14331005.490op/s 14340874.433op/s 14347320.332op/s 0.37% -0.808 0.478 0.21% 2177.172op/s 1 200
credit_card/is_card_number/37828224631000521389798 execution_time 52.133µs 52.204µs ± 0.036µs 52.199µs ± 0.022µs 52.223µs 52.278µs 52.296µs 52.300µs 0.19% 0.663 0.044 0.07% 0.003µs 1 200
credit_card/is_card_number/37828224631000521389798 throughput 19120491.261op/s 19155541.335op/s ± 13227.648op/s 19157592.753op/s ± 8195.683op/s 19164497.291op/s 19173111.725op/s 19178696.862op/s 19181878.879op/s 0.13% -0.660 0.039 0.07% 935.336op/s 1 200
credit_card/is_card_number/x371413321323331 execution_time 5.759µs 5.903µs ± 0.054µs 5.898µs ± 0.036µs 5.936µs 5.992µs 6.039µs 6.045µs 2.48% 0.079 -0.149 0.92% 0.004µs 1 200
credit_card/is_card_number/x371413321323331 throughput 165434286.964op/s 169430925.959op/s ± 1562160.317op/s 169537891.760op/s ± 1036638.094op/s 170516041.176op/s 171978847.356op/s 172713742.356op/s 173651681.773op/s 2.43% -0.028 -0.165 0.92% 110461.415op/s 1 200
credit_card/is_card_number_no_luhn/ execution_time 3.892µs 3.911µs ± 0.003µs 3.911µs ± 0.002µs 3.913µs 3.915µs 3.917µs 3.919µs 0.19% -1.827 14.189 0.07% 0.000µs 1 200
credit_card/is_card_number_no_luhn/ throughput 255184578.189op/s 255669290.071op/s ± 173020.631op/s 255672885.906op/s ± 108035.070op/s 255771833.520op/s 255897698.888op/s 255974953.488op/s 256964470.768op/s 0.51% 1.853 14.412 0.07% 12234.406op/s 1 200
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 execution_time 64.141µs 64.325µs ± 0.125µs 64.288µs ± 0.064µs 64.382µs 64.626µs 64.761µs 64.874µs 0.91% 1.753 3.548 0.19% 0.009µs 1 200
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 throughput 15414421.159op/s 15546090.936op/s ± 30145.230op/s 15554949.755op/s ± 15479.820op/s 15568010.856op/s 15576184.715op/s 15580167.285op/s 15590564.590op/s 0.23% -1.739 3.484 0.19% 2131.590op/s 1 200
credit_card/is_card_number_no_luhn/ 378282246310005 execution_time 57.401µs 57.573µs ± 0.130µs 57.541µs ± 0.067µs 57.627µs 57.825µs 58.054µs 58.097µs 0.97% 1.642 3.364 0.22% 0.009µs 1 200
credit_card/is_card_number_no_luhn/ 378282246310005 throughput 17212718.735op/s 17369286.779op/s ± 38999.957op/s 17378835.197op/s ± 20241.964op/s 17396048.519op/s 17411081.370op/s 17416981.580op/s 17421285.326op/s 0.24% -1.624 3.287 0.22% 2757.713op/s 1 200
credit_card/is_card_number_no_luhn/37828224631 execution_time 3.892µs 3.912µs ± 0.003µs 3.911µs ± 0.002µs 3.913µs 3.917µs 3.918µs 3.919µs 0.21% -0.993 9.725 0.07% 0.000µs 1 200
credit_card/is_card_number_no_luhn/37828224631 throughput 255148769.401op/s 255653188.928op/s ± 187657.654op/s 255672316.915op/s ± 102755.249op/s 255749939.822op/s 255883094.990op/s 255941468.663op/s 256928655.154op/s 0.49% 1.017 9.887 0.07% 13269.400op/s 1 200
credit_card/is_card_number_no_luhn/378282246310005 execution_time 54.574µs 54.843µs ± 0.186µs 54.794µs ± 0.087µs 54.915µs 55.248µs 55.459µs 55.540µs 1.36% 1.382 1.800 0.34% 0.013µs 1 200
credit_card/is_card_number_no_luhn/378282246310005 throughput 18005124.672op/s 18234091.595op/s ± 61548.897op/s 18250279.856op/s ± 29004.233op/s 18275602.538op/s 18303032.834op/s 18320877.448op/s 18323657.674op/s 0.40% -1.363 1.734 0.34% 4352.164op/s 1 200
credit_card/is_card_number_no_luhn/37828224631000521389798 execution_time 52.133µs 52.218µs ± 0.033µs 52.218µs ± 0.023µs 52.241µs 52.268µs 52.296µs 52.299µs 0.15% 0.054 -0.315 0.06% 0.002µs 1 200
credit_card/is_card_number_no_luhn/37828224631000521389798 throughput 19120955.880op/s 19150438.365op/s ± 12024.612op/s 19150503.608op/s ± 8276.277op/s 19158743.084op/s 19170141.930op/s 19177356.069op/s 19181530.105op/s 0.16% -0.050 -0.316 0.06% 850.269op/s 1 200
credit_card/is_card_number_no_luhn/x371413321323331 execution_time 5.729µs 5.903µs ± 0.054µs 5.900µs ± 0.037µs 5.940µs 5.978µs 6.012µs 6.036µs 2.30% -0.333 0.020 0.90% 0.004µs 1 200
credit_card/is_card_number_no_luhn/x371413321323331 throughput 165672144.801op/s 169411150.541op/s ± 1540871.993op/s 169487261.004op/s ± 1053389.233op/s 170425291.472op/s 172186517.414op/s 173036293.854op/s 174563788.896op/s 3.00% 0.385 0.079 0.91% 108956.104op/s 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
credit_card/is_card_number/ execution_time [3.912µs; 3.913µs] or [-0.010%; +0.010%] None None None
credit_card/is_card_number/ throughput [255584046.427op/s; 255633720.792op/s] or [-0.010%; +0.010%] None None None
credit_card/is_card_number/ 3782-8224-6310-005 execution_time [79.751µs; 79.804µs] or [-0.033%; +0.033%] None None None
credit_card/is_card_number/ 3782-8224-6310-005 throughput [12530815.267op/s; 12539091.012op/s] or [-0.033%; +0.033%] None None None
credit_card/is_card_number/ 378282246310005 execution_time [72.949µs; 72.997µs] or [-0.033%; +0.033%] None None None
credit_card/is_card_number/ 378282246310005 throughput [13699218.216op/s; 13708216.071op/s] or [-0.033%; +0.033%] None None None
credit_card/is_card_number/37828224631 execution_time [3.912µs; 3.913µs] or [-0.012%; +0.012%] None None None
credit_card/is_card_number/37828224631 throughput [255536825.892op/s; 255600344.710op/s] or [-0.012%; +0.012%] None None None
credit_card/is_card_number/378282246310005 execution_time [69.962µs; 70.003µs] or [-0.030%; +0.030%] None None None
credit_card/is_card_number/378282246310005 throughput [14285093.602op/s; 14293627.960op/s] or [-0.030%; +0.030%] None None None
credit_card/is_card_number/37828224631000521389798 execution_time [52.199µs; 52.209µs] or [-0.010%; +0.010%] None None None
credit_card/is_card_number/37828224631000521389798 throughput [19153708.110op/s; 19157374.560op/s] or [-0.010%; +0.010%] None None None
credit_card/is_card_number/x371413321323331 execution_time [5.895µs; 5.910µs] or [-0.128%; +0.128%] None None None
credit_card/is_card_number/x371413321323331 throughput [169214425.563op/s; 169647426.354op/s] or [-0.128%; +0.128%] None None None
credit_card/is_card_number_no_luhn/ execution_time [3.911µs; 3.912µs] or [-0.009%; +0.009%] None None None
credit_card/is_card_number_no_luhn/ throughput [255645311.076op/s; 255693269.066op/s] or [-0.009%; +0.009%] None None None
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 execution_time [64.308µs; 64.342µs] or [-0.027%; +0.027%] None None None
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 throughput [15541913.097op/s; 15550268.775op/s] or [-0.027%; +0.027%] None None None
credit_card/is_card_number_no_luhn/ 378282246310005 execution_time [57.555µs; 57.591µs] or [-0.031%; +0.031%] None None None
credit_card/is_card_number_no_luhn/ 378282246310005 throughput [17363881.760op/s; 17374691.798op/s] or [-0.031%; +0.031%] None None None
credit_card/is_card_number_no_luhn/37828224631 execution_time [3.911µs; 3.912µs] or [-0.010%; +0.010%] None None None
credit_card/is_card_number_no_luhn/37828224631 throughput [255627181.382op/s; 255679196.474op/s] or [-0.010%; +0.010%] None None None
credit_card/is_card_number_no_luhn/378282246310005 execution_time [54.817µs; 54.869µs] or [-0.047%; +0.047%] None None None
credit_card/is_card_number_no_luhn/378282246310005 throughput [18225561.509op/s; 18242621.680op/s] or [-0.047%; +0.047%] None None None
credit_card/is_card_number_no_luhn/37828224631000521389798 execution_time [52.214µs; 52.223µs] or [-0.009%; +0.009%] None None None
credit_card/is_card_number_no_luhn/37828224631000521389798 throughput [19148771.870op/s; 19152104.861op/s] or [-0.009%; +0.009%] None None None
credit_card/is_card_number_no_luhn/x371413321323331 execution_time [5.896µs; 5.911µs] or [-0.126%; +0.126%] None None None
credit_card/is_card_number_no_luhn/x371413321323331 throughput [169197600.503op/s; 169624700.580op/s] or [-0.126%; +0.126%] None None None

Group 10

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
profile_add_sample2_frames_x1000 execution_time 743.179µs 745.925µs ± 0.941µs 745.850µs ± 0.540µs 746.454µs 747.428µs 748.407µs 749.065µs 0.43% 0.300 0.844 0.13% 0.067µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
profile_add_sample2_frames_x1000 execution_time [745.794µs; 746.055µs] or [-0.017%; +0.017%] None None None

Group 11

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
single_flag_killswitch/rules-based execution_time 190.569ns 193.195ns ± 2.277ns 192.942ns ± 1.563ns 194.208ns 197.783ns 201.743ns 203.413ns 5.43% 1.607 3.609 1.18% 0.161ns 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
single_flag_killswitch/rules-based execution_time [192.879ns; 193.510ns] or [-0.163%; +0.163%] None None None

Group 12

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
normalization/normalize_trace/test_trace execution_time 244.725ns 254.647ns ± 11.923ns 249.293ns ± 3.399ns 256.019ns 283.367ns 289.639ns 292.733ns 17.43% 1.657 1.594 4.67% 0.843ns 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
normalization/normalize_trace/test_trace execution_time [252.994ns; 256.299ns] or [-0.649%; +0.649%] None None None

Group 13

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
benching string interning on wordpress profile execution_time 161.629µs 162.114µs ± 0.258µs 162.082µs ± 0.172µs 162.256µs 162.537µs 162.842µs 163.386µs 0.80% 1.354 4.077 0.16% 0.018µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
benching string interning on wordpress profile execution_time [162.078µs; 162.150µs] or [-0.022%; +0.022%] None None None

Group 14

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
redis/obfuscate_redis_string execution_time 33.140µs 33.636µs ± 0.862µs 33.237µs ± 0.036µs 33.351µs 35.443µs 35.479µs 37.435µs 12.63% 1.853 2.067 2.56% 0.061µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
redis/obfuscate_redis_string execution_time [33.516µs; 33.755µs] or [-0.355%; +0.355%] None None None

Group 15

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
write only interface execution_time 1.204µs 3.141µs ± 1.416µs 2.971µs ± 0.024µs 2.995µs 3.272µs 13.675µs 15.003µs 404.97% 7.553 57.462 44.97% 0.100µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
write only interface execution_time [2.945µs; 3.338µs] or [-6.249%; +6.249%] None None None

Group 16

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
profile_add_sample_frames_x1000 execution_time 4.111ms 4.115ms ± 0.007ms 4.114ms ± 0.001ms 4.116ms 4.119ms 4.122ms 4.210ms 2.32% 11.825 153.888 0.17% 0.001ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
profile_add_sample_frames_x1000 execution_time [4.114ms; 4.116ms] or [-0.024%; +0.024%] None None None

Group 17

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... execution_time 205.776µs 206.556µs ± 0.365µs 206.505µs ± 0.252µs 206.782µs 207.251µs 207.500µs 207.642µs 0.55% 0.484 -0.019 0.18% 0.026µs 1 200
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... throughput 4815982.606op/s 4841314.900op/s ± 8552.321op/s 4842503.148op/s ± 5903.586op/s 4847232.270op/s 4853347.259op/s 4858476.150op/s 4859650.024op/s 0.35% -0.475 -0.031 0.18% 604.740op/s 1 200
normalization/normalize_name/normalize_name/bad-name execution_time 18.576µs 18.694µs ± 0.098µs 18.676µs ± 0.030µs 18.716µs 18.841µs 18.908µs 19.657µs 5.26% 5.256 46.190 0.52% 0.007µs 1 200
normalization/normalize_name/normalize_name/bad-name throughput 50871410.009op/s 53493100.141op/s ± 272691.915op/s 53545020.719op/s ± 85123.552op/s 53615173.460op/s 53811812.171op/s 53825565.392op/s 53833074.585op/s 0.54% -4.945 42.049 0.51% 19282.230op/s 1 200
normalization/normalize_name/normalize_name/good execution_time 10.706µs 10.788µs ± 0.040µs 10.787µs ± 0.027µs 10.813µs 10.856µs 10.901µs 10.918µs 1.22% 0.373 0.138 0.37% 0.003µs 1 200
normalization/normalize_name/normalize_name/good throughput 91591610.488op/s 92699028.227op/s ± 346011.655op/s 92708445.576op/s ± 233275.537op/s 92944633.302op/s 93252681.000op/s 93380845.616op/s 93408697.277op/s 0.76% -0.351 0.104 0.37% 24466.719op/s 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... execution_time [206.505µs; 206.607µs] or [-0.025%; +0.025%] None None None
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... throughput [4840129.631op/s; 4842500.170op/s] or [-0.024%; +0.024%] None None None
normalization/normalize_name/normalize_name/bad-name execution_time [18.681µs; 18.708µs] or [-0.073%; +0.073%] None None None
normalization/normalize_name/normalize_name/bad-name throughput [53455307.664op/s; 53530892.617op/s] or [-0.071%; +0.071%] None None None
normalization/normalize_name/normalize_name/good execution_time [10.782µs; 10.793µs] or [-0.052%; +0.052%] None None None
normalization/normalize_name/normalize_name/good throughput [92651074.340op/s; 92746982.115op/s] or [-0.052%; +0.052%] None None None

Group 18

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
sdk_test_data/rules-based execution_time 144.860µs 147.116µs ± 1.651µs 146.887µs ± 0.519µs 147.464µs 148.577µs 153.787µs 161.941µs 10.25% 5.523 40.916 1.12% 0.117µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
sdk_test_data/rules-based execution_time [146.888µs; 147.345µs] or [-0.156%; +0.156%] None None None

Group 19

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz e93220a 1773246231 leiyks/sidecar-threaded-fallback
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
sql/obfuscate_sql_string execution_time 87.723µs 87.958µs ± 0.275µs 87.912µs ± 0.060µs 87.994µs 88.187µs 88.278µs 91.384µs 3.95% 9.866 119.377 0.31% 0.019µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
sql/obfuscate_sql_string execution_time [87.920µs; 87.996µs] or [-0.043%; +0.043%] None None None

Baseline

Omitted due to size.

@Leiyks Leiyks force-pushed the leiyks/sidecar-threaded-fallback branch from 917aceb to d87edf1 Compare January 15, 2026 12:56
@dd-octo-sts
Copy link
Contributor

dd-octo-sts bot commented Jan 15, 2026

Artifact Size Benchmark Report

aarch64-alpine-linux-musl
Artifact Baseline Commit Change
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.a 100.28 MB 100.28 MB 0% (0 B) 👌
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 8.63 MB 8.63 MB 0% (0 B) 👌
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 11.21 MB 11.21 MB 0% (0 B) 👌
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 116.94 MB 116.94 MB 0% (0 B) 👌
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 27.16 MB 27.16 MB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 76.26 KB 76.26 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 186.02 MB 186.02 MB 0% (0 B) 👌
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 917.15 MB 917.15 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 9.93 MB 9.93 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 76.26 KB 76.26 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 24.77 MB 24.77 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 51.43 MB 51.43 MB 0% (0 B) 👌
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 22.97 MB 22.97 MB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 77.44 KB 77.44 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 190.24 MB 190.24 MB 0% (0 B) 👌
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 900.80 MB 900.80 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 7.53 MB 7.53 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 77.44 KB 77.44 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 26.51 MB 26.51 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 47.05 MB 47.05 MB 0% (0 B) 👌
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 87.50 MB 87.50 MB 0% (0 B) 👌
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 10.21 MB 10.21 MB 0% (0 B) 👌
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 109.81 MB 109.81 MB 0% (0 B) 👌
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 11.95 MB 11.95 MB 0% (0 B) 👌

@Leiyks Leiyks force-pushed the leiyks/sidecar-threaded-fallback branch from d87edf1 to 34adc5d Compare January 15, 2026 13:47
@Leiyks Leiyks force-pushed the leiyks/sidecar-threaded-fallback branch 6 times, most recently from 31a48ff to 801ac3e Compare January 26, 2026 12:35
@Leiyks Leiyks marked this pull request as ready for review January 26, 2026 12:36
@Leiyks Leiyks requested review from a team as code owners January 26, 2026 12:36
@Leiyks Leiyks force-pushed the leiyks/sidecar-threaded-fallback branch from 801ac3e to b7d89dd Compare January 26, 2026 16:02
@Leiyks Leiyks force-pushed the leiyks/sidecar-threaded-fallback branch from b7d89dd to cc2fb3d Compare February 18, 2026 13:25
@github-actions
Copy link

github-actions bot commented Feb 18, 2026

Clippy Allow Annotation Report

Comparing clippy allow annotations between branches:

  • Base Branch: origin/main
  • PR Branch: origin/leiyks/sidecar-threaded-fallback

Summary by Rule

Rule Base Branch PR Branch Change
panic 1 1 No change (0%)
unwrap_used 11 11 No change (0%)
Total 12 12 No change (0%)

Annotation Counts by File

File Base Branch PR Branch Change
datadog-ipc/src/platform/unix/mem_handle.rs 2 2 No change (0%)
datadog-ipc/src/platform/unix/mem_handle_macos.rs 6 6 No change (0%)
datadog-sidecar/src/unix.rs 4 4 No change (0%)

Annotation Stats by Crate

Crate Base Branch PR Branch Change
clippy-annotation-reporter 5 5 No change (0%)
datadog-ffe-ffi 1 1 No change (0%)
datadog-ipc 28 28 No change (0%)
datadog-live-debugger 6 6 No change (0%)
datadog-live-debugger-ffi 10 10 No change (0%)
datadog-profiling-replayer 4 4 No change (0%)
datadog-remote-config 3 3 No change (0%)
datadog-sidecar 59 59 No change (0%)
libdd-common 10 10 No change (0%)
libdd-common-ffi 12 12 No change (0%)
libdd-data-pipeline 5 5 No change (0%)
libdd-ddsketch 2 2 No change (0%)
libdd-dogstatsd-client 1 1 No change (0%)
libdd-profiling 13 13 No change (0%)
libdd-telemetry 19 19 No change (0%)
libdd-tinybytes 4 4 No change (0%)
libdd-trace-normalization 2 2 No change (0%)
libdd-trace-obfuscation 9 9 No change (0%)
libdd-trace-utils 15 15 No change (0%)
Total 208 208 No change (0%)

About This Report

This report tracks Clippy allow annotations for specific rules, showing how they've changed in this PR. Decreasing the number of these annotations generally improves code quality.

@Leiyks Leiyks force-pushed the leiyks/sidecar-threaded-fallback branch from cc2fb3d to 8beb392 Compare March 2, 2026 14:38
@bwoebi
Copy link
Contributor

bwoebi commented Mar 3, 2026

So, on Linux connect_to_master() does not use the pid for connections to master. (= it connects to a "random" (first to spawn) PHP process.)
On windows it does.

However the primary_sidecar_identifier is unchanged - it would need to incorporate the pid instead of the euid (linux)/user terminal id (windows) in threaded mode. Otherwise multiple processes are going to interfere and use the same resources.

@Leiyks Leiyks force-pushed the leiyks/sidecar-threaded-fallback branch 3 times, most recently from d148ca6 to 69a98fb Compare March 6, 2026 14:02
@Leiyks Leiyks requested a review from bwoebi March 10, 2026 12:10
Leiyks added 2 commits March 11, 2026 17:23
Signed-off-by: Alexandre Rulleau <alexandre.rulleau@datadoghq.com>
Signed-off-by: Alexandre Rulleau <alexandre.rulleau@datadoghq.com>
Leiyks added 11 commits March 11, 2026 17:23
Signed-off-by: Alexandre Rulleau <alexandre.rulleau@datadoghq.com>
…interference

In thread mode on Linux, primary_sidecar_identifier() returned geteuid(),
causing all PHP processes with the same euid to share the same Unix socket
and sidecar resources (SHM, rate limiters, crash tracker, etc.).

- Add set_sidecar_master_pid(pid) and update primary_sidecar_identifier()
  to return the stored PID instead of euid when in thread mode
- Add SharedDirLiaison::ipc_for_pid(pid) to build per-master socket paths
- Use ipc_for_pid(pid) in both run_listener and connect_to_master so the
  socket path is always pid-specific, matching Windows named-pipe behavior
- Call set_sidecar_master_pid from ddog_sidecar_connect_master so all shared
  resources use the master PID as their identifier key
… compatibility

Thread-mode sockets are placed in /tmp/libdatadog/ with the master's effective
uid encoded in the socket name (libdd.<ver>@<uid>-<pid>.sock). This ensures that
a worker process that has since dropped privileges via setuid() (e.g. www-data
under PHP-FPM) still computes the same socket path as the master listener.

Also fix ensure_dir_exists to always attempt chmod 0o777 (best-effort, ignoring
EPERM) so that even pre-existing directories get the world-writable bit set when
the process has sufficient permissions.

Also fix socket/lock path construction: remove spurious .with_extension(".sock")
(which produced a double-dot suffix on Rust >=1.87) and use "sock.lock" without
a leading dot for the lock file.
…untime

- Switch thread mode IPC to AbstractUnixSocketLiaison on Linux: abstract
  sockets have no filesystem permissions, so PHP-FPM workers running as
  a different user (e.g. www-data) can connect to a sidecar thread running
  in the master process without any chmod/chown workarounds
- Use new_current_thread() Tokio runtime in run_listener to avoid spawning
  extra OS worker threads that trigger LSan "Running thread was not
  suspended" warnings at process exit under ASAN
- Move UnixListener::from_std() inside block_on so it runs with an active
  Tokio reactor (required by the tokio::net API)
- Remove unused SIDECAR_MASTER_UID tracking (replaced by abstract sockets)
- Keep SharedDirLiaison::attempt_listen chmod 0o777 for non-Linux platforms
In thread mode under PHP-FPM, the sidecar runs as a thread inside the
master process (possibly root). Named SHM objects (/ddlimiters-*, /ddrc*,
/ddcfg*) were created with 0600 (owner-only), preventing PHP worker
processes running as a different user (e.g. www-data) from opening them.

Add a global SHM_OPEN_MODE atomic in datadog-ipc that defaults to 0600.
NamedShmHandle::create() now reads this global instead of hardcoding the
mode. Expose ddog_sidecar_set_shm_open_mode() via FFI so the PHP
extension can set 0644 before starting the sidecar master listener when
running as root.
In PHP-FPM thread mode the master process runs as root and spawns worker
processes as www-data. Named POSIX SHM objects were created with 0600
(owner-only), so workers could not open them for writing.

The correct fix is to fchown() the SHM to the worker's UID after creation.
The worker UID is obtained via SO_PEERCRED (peer_cred()) on the first
accepted Unix socket connection in the thread listener, before the SHM
lazy-lock is initialized.

Changes:
- Replace set_shm_open_mode/SHM_OPEN_MODE with set_shm_owner_uid/SHM_OWNER_UID
  in both mem_handle.rs and mem_handle_macos.rs
- Call fchown(fd, worker_uid, None) in NamedShmHandle::create_mode() when
  SHM_OWNER_UID is set; restore default mode to S_IWUSR|S_IRUSR (0600)
- Add nix "user" feature to datadog-ipc for fchown/Uid support
- Add init_shm_eagerly field to MainLoopConfig (default true); thread mode
  sets it false to defer SHM initialization to first connection
- In accept_socket_loop_thread: use FIRST_CONNECTION_INIT OnceLock to call
  set_shm_owner_uid(peer_uid) then init SHM_LIMITER exactly once on first
  worker connection
- Remove ddog_sidecar_set_shm_open_mode FFI function (no longer needed)
@Leiyks Leiyks force-pushed the leiyks/sidecar-threaded-fallback branch from a66093e to e93220a Compare March 11, 2026 16:23
@Leiyks Leiyks changed the title feat(sidecar): implement thread listener module feat(sidecar): add thread mode as fallback connection for restricted environments Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants