Skip to content

Comments

feat: process context publication#1585

Draft
yannham wants to merge 3 commits intomainfrom
yannham/process-context-sharing
Draft

feat: process context publication#1585
yannham wants to merge 3 commits intomainfrom
yannham/process-context-sharing

Conversation

@yannham
Copy link

@yannham yannham commented Feb 17, 2026

What does this PR do?

This PR implements the publication protocol of the process context sharing proposal.

This is intended as a minimally viable starting point. Next steps are kept for follow-up PRs, which could include for example:

  • expose the additional functions in the FFI
  • add the missing update protocol
  • add a function taking a structured object and encode it, instead of assuming a raw, already encoded payload

Motivation

This feature allows a process to expose data to an external process, typically an eBPF profiler. Please refer to the OTEP linked above for a detailed motivation.

Additional Notes

Some notes on dependencies:

  • This PR needs a handful of linux syscalls. I used rustix for that since it's already pulled as a transitive dependency (with the same major version bucket), and is nicely higher-level than libc.
  • I see that there's already a small MemFd wrapper crate used (e.g here
    pub enum AnonymousFileHandle {
    ). Unfortunately, it doesn't handle some options like NOEXEC, and doesn't really bring much over the basic rustix wrappers, so I didn't use that (question: should we take the occasion to kill a dependency and use rustix everywhere?)

There are a number of design choices or assumptions that might be interesting to discuss further:

  • on paper, a reader might be concurrently reading what the process is currently publishing, which could lead to race conditions (even more since the reader is another, uncontrolled process). However, the reader doesn't access the memory directly, but use /proc/<pid>/maps and syscalls to do so, so the concurrency model is a bit unclear. We basically settled on the mental model being that we use atomics as if the reader was another thread of the same program, which sounds like the best we can do and should prevent re-ordering at least on the writer side (using OS-level sync is another solution, but was deemed too costly for the upcoming thread-level context).
  • we must manage the following resources: the mmaped region and the payload, avoiding either leaking them or releasing them too early (nullifying the capacity to read, or worse making it read garbage). We settled with @ivoanjo on hiding that from the API user, by using a static. We use a mutex here instead of smarter lock-free style because it's mostly to please the Rust typesystem; we don't expect publications to happen often, and it should most likely be done from the same thread. The memory is guaranteed to be preserved, but the user can still free it explicitly if needed.
  • Regarding the payload, there might be room to make the internal interface safer (e.g. using Pin<Box<[u8]>> ?), and maybe offer the option - or do it automatically, depending on the size - of moving the payload directly after the header, as allowed by the spec. This is left for future work.

How to test the change?

TODO

@github-actions
Copy link

github-actions bot commented Feb 17, 2026

📚 Documentation Check Results

No documentation warnings found!

📦 libdd-library-config - ✅ No warnings


Updated: 2026-02-20 16:39:05 UTC | Commit: 39386ac | missing-docs job results

@github-actions
Copy link

github-actions bot commented Feb 17, 2026

Clippy Allow Annotation Report

Comparing clippy allow annotations between branches:

  • Base Branch: origin/main
  • PR Branch: origin/yannham/process-context-sharing

Summary by Rule

Rule Base Branch PR Branch Change

Annotation Counts by File

File Base Branch PR Branch Change

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 27 27 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-crashtracker 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 219 219 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.

@github-actions
Copy link

github-actions bot commented Feb 17, 2026

🔒 Cargo Deny Results

No issues found!

📦 libdd-library-config - ✅ No issues


Updated: 2026-02-20 16:42:36 UTC | Commit: 39386ac | dependency-check job results

@pr-commenter
Copy link

pr-commenter bot commented Feb 17, 2026

Benchmarks

Comparison

Benchmark execution time: 2026-02-20 16:55:55

Comparing candidate commit 74d2641 in PR branch yannham/process-context-sharing with baseline commit 4d79e24 in branch main.

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

scenario:credit_card/is_card_number/37828224631000521389798

  • 🟥 execution_time [+6.349µs; +6.383µs] or [+13.899%; +13.975%]
  • 🟥 throughput [-2685759.348op/s; -2670042.305op/s] or [-12.268%; -12.197%]

scenario:credit_card/is_card_number/x371413321323331

  • 🟩 execution_time [-585.886ns; -580.614ns] or [-8.850%; -8.770%]
  • 🟩 throughput [+14529630.120op/s; +14655760.724op/s] or [+9.619%; +9.702%]

scenario:credit_card/is_card_number_no_luhn/ 378282246310005

  • 🟥 execution_time [+4.628µs; +4.675µs] or [+8.662%; +8.749%]
  • 🟥 throughput [-1505679.660op/s; -1491793.580op/s] or [-8.045%; -7.970%]

scenario:credit_card/is_card_number_no_luhn/378282246310005

  • 🟥 execution_time [+4.442µs; +4.500µs] or [+8.848%; +8.963%]
  • 🟥 throughput [-1638142.476op/s; -1618780.879op/s] or [-8.225%; -8.128%]

scenario:credit_card/is_card_number_no_luhn/37828224631000521389798

  • 🟥 execution_time [+6.388µs; +6.416µs] or [+13.997%; +14.060%]
  • 🟥 throughput [-2702317.451op/s; -2689725.299op/s] or [-12.332%; -12.274%]

scenario:credit_card/is_card_number_no_luhn/x371413321323331

  • 🟩 execution_time [-591.444ns; -586.973ns] or [-8.927%; -8.859%]
  • 🟩 throughput [+14679475.315op/s; +14784635.404op/s] or [+9.726%; +9.795%]

scenario:tags/replace_trace_tags

  • 🟥 execution_time [+98.246ns; +105.242ns] or [+4.127%; +4.421%]

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 74d2641 1771605476 yannham/process-context-sharing
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 143.870µs 145.745µs ± 1.865µs 145.479µs ± 0.533µs 145.995µs 147.234µs 151.871µs 164.874µs 13.33% 6.805 59.971 1.28% 0.132µ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 [145.487µs; 146.004µs] or [-0.177%; +0.177%] None None None

Group 2

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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/2597 execution_time 3.403ms 3.432ms ± 0.011ms 3.432ms ± 0.006ms 3.437ms 3.452ms 3.464ms 3.489ms 1.67% 1.037 3.408 0.33% 0.001ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
receiver_entry_point/report/2597 execution_time [3.431ms; 3.434ms] or [-0.046%; +0.046%] None None None

Group 3

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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.897µs 3.912µs ± 0.003µs 3.912µs ± 0.002µs 3.914µs 3.917µs 3.919µs 3.920µs 0.20% -0.291 4.050 0.07% 0.000µs 1 200
credit_card/is_card_number/ throughput 255123471.978op/s 255596812.504op/s ± 178802.215op/s 255622508.037op/s ± 112722.297op/s 255716947.642op/s 255817894.956op/s 255865984.830op/s 256594900.375op/s 0.38% 0.303 4.110 0.07% 12643.226op/s 1 200
credit_card/is_card_number/ 3782-8224-6310-005 execution_time 76.533µs 77.907µs ± 0.596µs 77.806µs ± 0.401µs 78.281µs 78.976µs 79.694µs 79.969µs 2.78% 0.636 0.610 0.76% 0.042µs 1 200
credit_card/is_card_number/ 3782-8224-6310-005 throughput 12504777.746op/s 12836615.949op/s ± 97711.393op/s 12852420.344op/s ± 66296.472op/s 12903300.025op/s 12984865.641op/s 13012099.927op/s 13066277.528op/s 1.66% -0.586 0.512 0.76% 6909.239op/s 1 200
credit_card/is_card_number/ 378282246310005 execution_time 69.926µs 70.884µs ± 0.589µs 70.803µs ± 0.375µs 71.299µs 71.996µs 72.276µs 72.849µs 2.89% 0.674 0.008 0.83% 0.042µs 1 200
credit_card/is_card_number/ 378282246310005 throughput 13726943.448op/s 14108595.589op/s ± 116555.719op/s 14123792.970op/s ± 75186.161op/s 14197383.072op/s 14269518.626op/s 14289225.497op/s 14300869.755op/s 1.25% -0.636 -0.069 0.82% 8241.734op/s 1 200
credit_card/is_card_number/37828224631 execution_time 3.889µs 3.913µs ± 0.008µs 3.912µs ± 0.002µs 3.915µs 3.917µs 3.921µs 3.993µs 2.06% 7.888 72.046 0.21% 0.001µs 1 200
credit_card/is_card_number/37828224631 throughput 250429458.107op/s 255527516.502op/s ± 534775.041op/s 255592562.258op/s ± 122440.935op/s 255695489.484op/s 255797072.467op/s 255853296.311op/s 257113834.837op/s 0.60% -7.812 71.237 0.21% 37814.306op/s 1 200
credit_card/is_card_number/378282246310005 execution_time 66.747µs 68.218µs ± 0.683µs 68.146µs ± 0.440µs 68.643µs 69.515µs 69.939µs 70.475µs 3.42% 0.533 0.180 1.00% 0.048µs 1 200
credit_card/is_card_number/378282246310005 throughput 14189423.434op/s 14660398.394op/s ± 146144.381op/s 14674429.537op/s ± 95321.285op/s 14757545.940op/s 14874265.876op/s 14947454.855op/s 14981971.020op/s 2.10% -0.476 0.096 0.99% 10333.968op/s 1 200
credit_card/is_card_number/37828224631000521389798 execution_time 51.885µs 52.046µs ± 0.060µs 52.051µs ± 0.041µs 52.089µs 52.141µs 52.161µs 52.182µs 0.25% -0.272 -0.331 0.11% 0.004µs 1 200
credit_card/is_card_number/37828224631000521389798 throughput 19163669.654op/s 19213901.677op/s ± 22158.231op/s 19211785.251op/s ± 15202.999op/s 19229152.592op/s 19253519.597op/s 19264034.073op/s 19273477.767op/s 0.32% 0.277 -0.327 0.12% 1566.824op/s 1 200
credit_card/is_card_number/x371413321323331 execution_time 6.028µs 6.037µs ± 0.009µs 6.035µs ± 0.003µs 6.038µs 6.046µs 6.078µs 6.109µs 1.21% 4.523 26.440 0.15% 0.001µs 1 200
credit_card/is_card_number/x371413321323331 throughput 163699073.485op/s 165644378.777op/s ± 245141.066op/s 165686662.254op/s ± 84470.139op/s 165771252.629op/s 165818547.028op/s 165846097.819op/s 165879498.205op/s 0.12% -4.488 26.052 0.15% 17334.091op/s 1 200
credit_card/is_card_number_no_luhn/ execution_time 3.895µs 3.912µs ± 0.003µs 3.912µs ± 0.001µs 3.913µs 3.917µs 3.921µs 3.921µs 0.23% -0.381 8.828 0.07% 0.000µs 1 200
credit_card/is_card_number_no_luhn/ throughput 255046272.681op/s 255612290.030op/s ± 172197.859op/s 255631573.571op/s ± 90533.879op/s 255724174.205op/s 255797568.035op/s 255858118.739op/s 256722125.679op/s 0.43% 0.403 8.942 0.07% 12176.227op/s 1 200
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 execution_time 63.695µs 64.192µs ± 0.190µs 64.167µs ± 0.116µs 64.305µs 64.549µs 64.697µs 64.778µs 0.95% 0.471 0.243 0.30% 0.013µs 1 200
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 throughput 15437261.928op/s 15578496.821op/s ± 46120.772op/s 15584310.495op/s ± 28201.372op/s 15610794.483op/s 15645998.090op/s 15672060.098op/s 15699904.774op/s 0.74% -0.453 0.225 0.30% 3261.231op/s 1 200
credit_card/is_card_number_no_luhn/ 378282246310005 execution_time 57.831µs 58.080µs ± 0.165µs 58.039µs ± 0.069µs 58.119µs 58.405µs 58.607µs 58.899µs 1.48% 1.725 3.914 0.28% 0.012µs 1 200
credit_card/is_card_number_no_luhn/ 378282246310005 throughput 16978081.983op/s 17217755.642op/s ± 48674.920op/s 17229885.568op/s ± 20567.484op/s 17248646.898op/s 17269146.166op/s 17285869.459op/s 17291724.181op/s 0.36% -1.700 3.778 0.28% 3441.837op/s 1 200
credit_card/is_card_number_no_luhn/37828224631 execution_time 3.896µs 3.913µs ± 0.003µs 3.913µs ± 0.002µs 3.915µs 3.919µs 3.920µs 3.923µs 0.25% -0.203 4.375 0.08% 0.000µs 1 200
credit_card/is_card_number_no_luhn/37828224631 throughput 254927806.360op/s 255543713.006op/s ± 199315.520op/s 255572832.638op/s ± 115711.704op/s 255677668.487op/s 255775982.828op/s 255850434.853op/s 256668227.496op/s 0.43% 0.217 4.446 0.08% 14093.736op/s 1 200
credit_card/is_card_number_no_luhn/378282246310005 execution_time 54.334µs 54.679µs ± 0.207µs 54.643µs ± 0.110µs 54.769µs 55.071µs 55.354µs 55.522µs 1.61% 1.291 1.939 0.38% 0.015µs 1 200
credit_card/is_card_number_no_luhn/378282246310005 throughput 18010733.216op/s 18288662.105op/s ± 68754.228op/s 18300651.507op/s ± 36940.560op/s 18334950.560op/s 18375741.869op/s 18387746.168op/s 18404535.924op/s 0.57% -1.265 1.849 0.37% 4861.658op/s 1 200
credit_card/is_card_number_no_luhn/37828224631000521389798 execution_time 51.860µs 52.035µs ± 0.063µs 52.034µs ± 0.039µs 52.076µs 52.137µs 52.179µs 52.191µs 0.30% -0.069 -0.117 0.12% 0.004µs 1 200
credit_card/is_card_number_no_luhn/37828224631000521389798 throughput 19160269.900op/s 19217711.823op/s ± 23122.221op/s 19218279.073op/s ± 14444.859op/s 19231861.039op/s 19255345.028op/s 19271179.115op/s 19282506.910op/s 0.33% 0.075 -0.115 0.12% 1634.988op/s 1 200
credit_card/is_card_number_no_luhn/x371413321323331 execution_time 6.029µs 6.036µs ± 0.006µs 6.035µs ± 0.003µs 6.038µs 6.044µs 6.070µs 6.075µs 0.67% 3.467 18.020 0.10% 0.000µs 1 200
credit_card/is_card_number_no_luhn/x371413321323331 throughput 164602022.211op/s 165665007.924op/s ± 165164.115op/s 165698732.406op/s ± 69987.016op/s 165761049.796op/s 165834406.299op/s 165862135.388op/s 165876824.695op/s 0.11% -3.443 17.827 0.10% 11678.867op/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 [255572032.236op/s; 255621592.771op/s] or [-0.010%; +0.010%] None None None
credit_card/is_card_number/ 3782-8224-6310-005 execution_time [77.824µs; 77.989µs] or [-0.106%; +0.106%] None None None
credit_card/is_card_number/ 3782-8224-6310-005 throughput [12823074.090op/s; 12850157.808op/s] or [-0.105%; +0.105%] None None None
credit_card/is_card_number/ 378282246310005 execution_time [70.802µs; 70.965µs] or [-0.115%; +0.115%] None None None
credit_card/is_card_number/ 378282246310005 throughput [14092442.087op/s; 14124749.090op/s] or [-0.114%; +0.114%] None None None
credit_card/is_card_number/37828224631 execution_time [3.912µs; 3.915µs] or [-0.029%; +0.029%] None None None
credit_card/is_card_number/37828224631 throughput [255453401.824op/s; 255601631.179op/s] or [-0.029%; +0.029%] None None None
credit_card/is_card_number/378282246310005 execution_time [68.123µs; 68.312µs] or [-0.139%; +0.139%] None None None
credit_card/is_card_number/378282246310005 throughput [14640144.189op/s; 14680652.600op/s] or [-0.138%; +0.138%] None None None
credit_card/is_card_number/37828224631000521389798 execution_time [52.037µs; 52.054µs] or [-0.016%; +0.016%] None None None
credit_card/is_card_number/37828224631000521389798 throughput [19210830.759op/s; 19216972.595op/s] or [-0.016%; +0.016%] None None None
credit_card/is_card_number/x371413321323331 execution_time [6.036µs; 6.038µs] or [-0.021%; +0.021%] None None None
credit_card/is_card_number/x371413321323331 throughput [165610404.583op/s; 165678352.971op/s] or [-0.021%; +0.021%] None None None
credit_card/is_card_number_no_luhn/ execution_time [3.912µs; 3.913µs] or [-0.009%; +0.009%] None None None
credit_card/is_card_number_no_luhn/ throughput [255588425.062op/s; 255636154.997op/s] or [-0.009%; +0.009%] None None None
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 execution_time [64.165µs; 64.218µs] or [-0.041%; +0.041%] None None None
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 throughput [15572104.925op/s; 15584888.716op/s] or [-0.041%; +0.041%] None None None
credit_card/is_card_number_no_luhn/ 378282246310005 execution_time [58.057µs; 58.103µs] or [-0.039%; +0.039%] None None None
credit_card/is_card_number_no_luhn/ 378282246310005 throughput [17211009.766op/s; 17224501.518op/s] or [-0.039%; +0.039%] None None None
credit_card/is_card_number_no_luhn/37828224631 execution_time [3.913µs; 3.914µs] or [-0.011%; +0.011%] None None None
credit_card/is_card_number_no_luhn/37828224631 throughput [255516089.792op/s; 255571336.221op/s] or [-0.011%; +0.011%] None None None
credit_card/is_card_number_no_luhn/378282246310005 execution_time [54.651µs; 54.708µs] or [-0.052%; +0.052%] None None None
credit_card/is_card_number_no_luhn/378282246310005 throughput [18279133.430op/s; 18298190.780op/s] or [-0.052%; +0.052%] None None None
credit_card/is_card_number_no_luhn/37828224631000521389798 execution_time [52.027µs; 52.044µs] or [-0.017%; +0.017%] None None None
credit_card/is_card_number_no_luhn/37828224631000521389798 throughput [19214507.305op/s; 19220916.340op/s] or [-0.017%; +0.017%] None None None
credit_card/is_card_number_no_luhn/x371413321323331 execution_time [6.035µs; 6.037µs] or [-0.014%; +0.014%] None None None
credit_card/is_card_number_no_luhn/x371413321323331 throughput [165642117.766op/s; 165687898.082op/s] or [-0.014%; +0.014%] None None None

Group 4

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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 160.207µs 160.852µs ± 0.286µs 160.806µs ± 0.102µs 160.943µs 161.221µs 161.640µs 163.573µs 1.72% 4.712 40.436 0.18% 0.020µ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 [160.812µs; 160.891µs] or [-0.025%; +0.025%] None None None

Group 5

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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 744.212µs 746.160µs ± 0.635µs 746.108µs ± 0.402µs 746.548µs 747.338µs 747.760µs 748.333µs 0.30% 0.391 0.448 0.08% 0.045µ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 [746.072µs; 746.248µs] or [-0.012%; +0.012%] None None None

Group 6

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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.213µs 3.206µs ± 1.424µs 3.001µs ± 0.031µs 3.030µs 3.671µs 13.851µs 14.826µs 394.08% 7.311 54.740 44.29% 0.101µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
write only interface execution_time [3.009µs; 3.404µs] or [-6.154%; +6.154%] None None None

Group 7

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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 185.841µs 186.724µs ± 0.816µs 186.422µs ± 0.252µs 186.947µs 188.431µs 189.327µs 191.273µs 2.60% 1.989 5.068 0.44% 0.058µs 1 200
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... throughput 5228132.844op/s 5355587.519op/s ± 23204.656op/s 5364178.792op/s ± 7265.375op/s 5370207.325op/s 5375748.599op/s 5379872.625op/s 5380956.231op/s 0.31% -1.950 4.781 0.43% 1640.817op/s 1 200
normalization/normalize_name/normalize_name/bad-name execution_time 17.825µs 17.986µs ± 0.068µs 17.990µs ± 0.044µs 18.033µs 18.083µs 18.111µs 18.325µs 1.86% 0.337 2.082 0.38% 0.005µs 1 200
normalization/normalize_name/normalize_name/bad-name throughput 54570059.014op/s 55598515.280op/s ± 211092.271op/s 55587228.887op/s ± 136207.050op/s 55728321.169op/s 55967975.943op/s 56043211.030op/s 56099897.417op/s 0.92% -0.293 1.907 0.38% 14926.478op/s 1 200
normalization/normalize_name/normalize_name/good execution_time 9.791µs 9.837µs ± 0.022µs 9.836µs ± 0.015µs 9.853µs 9.873µs 9.889µs 9.899µs 0.64% 0.315 -0.133 0.22% 0.002µs 1 200
normalization/normalize_name/normalize_name/good throughput 101024093.481op/s 101658112.225op/s ± 222050.716op/s 101668480.314op/s ± 158726.652op/s 101820504.362op/s 101961043.116op/s 102115122.139op/s 102138722.956op/s 0.46% -0.304 -0.142 0.22% 15701.357op/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 [186.611µs; 186.837µs] or [-0.061%; +0.061%] None None None
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... throughput [5352371.577op/s; 5358803.461op/s] or [-0.060%; +0.060%] None None None
normalization/normalize_name/normalize_name/bad-name execution_time [17.977µs; 17.996µs] or [-0.053%; +0.053%] None None None
normalization/normalize_name/normalize_name/bad-name throughput [55569259.921op/s; 55627770.638op/s] or [-0.053%; +0.053%] None None None
normalization/normalize_name/normalize_name/good execution_time [9.834µs; 9.840µs] or [-0.030%; +0.030%] None None None
normalization/normalize_name/normalize_name/good throughput [101627338.131op/s; 101688886.319op/s] or [-0.030%; +0.030%] None None None

Group 8

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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 48.497ms 48.978ms ± 1.322ms 48.828ms ± 0.093ms 48.906ms 49.079ms 53.940ms 63.256ms 29.55% 9.089 86.344 2.69% 0.093ms 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 [48.795ms; 49.161ms] or [-0.374%; +0.374%] None None None

Group 9

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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.187µs 33.973µs ± 1.026µs 33.366µs ± 0.101µs 34.935µs 35.911µs 36.046µs 37.188µs 11.46% 1.096 -0.445 3.01% 0.073µ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.831µs; 34.115µs] or [-0.419%; +0.419%] None None None

Group 10

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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.723ns 256.598ns ± 11.765ns 250.609ns ± 4.787ns 262.522ns 284.059ns 289.230ns 294.927ns 17.68% 1.301 0.966 4.57% 0.832ns 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 [254.967ns; 258.228ns] or [-0.635%; +0.635%] None None None

Group 11

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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.665ms 10.692ms ± 0.014ms 10.690ms ± 0.008ms 10.700ms 10.716ms 10.726ms 10.788ms 0.92% 1.921 8.915 0.14% 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.690ms; 10.694ms] or [-0.019%; +0.019%] None None None

Group 12

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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.172ms 4.176ms ± 0.007ms 4.175ms ± 0.002ms 4.178ms 4.180ms 4.182ms 4.267ms 2.21% 11.542 149.460 0.16% 0.000ms 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.175ms; 4.177ms] or [-0.023%; +0.023%] None None None

Group 13

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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 186.449ns 189.735ns ± 2.456ns 189.181ns ± 1.526ns 190.915ns 194.276ns 197.515ns 201.517ns 6.52% 1.489 3.191 1.29% 0.174ns 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 [189.395ns; 190.076ns] or [-0.179%; +0.179%] None None None

Group 14

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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.777ms 13.819ms ± 0.027ms 13.815ms ± 0.012ms 13.828ms 13.847ms 13.928ms 13.990ms 1.27% 3.159 15.343 0.19% 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.815ms; 13.823ms] or [-0.027%; +0.027%] None None None

Group 15

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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.439µs 2.482µs ± 0.020µs 2.480µs ± 0.012µs 2.492µs 2.527µs 2.536µs 2.540µs 2.44% 0.706 0.291 0.82% 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.480µs; 2.485µs] or [-0.113%; +0.113%] None None None

Group 16

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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 494.297µs 494.986µs ± 0.950µs 494.890µs ± 0.281µs 495.183µs 495.700µs 496.603µs 506.820µs 2.41% 9.844 119.020 0.19% 0.067µs 1 200
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... throughput 1973086.443op/s 2020265.232op/s ± 3805.234op/s 2020651.734op/s ± 1148.581op/s 2021772.581op/s 2022820.028op/s 2023066.162op/s 2023077.015op/s 0.12% -9.706 116.657 0.19% 269.071op/s 1 200
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて execution_time 370.633µs 371.377µs ± 0.316µs 371.357µs ± 0.182µs 371.545µs 371.931µs 372.125µs 372.983µs 0.44% 0.821 2.640 0.08% 0.022µs 1 200
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて throughput 2681084.529op/s 2692681.117op/s ± 2290.122op/s 2692825.003op/s ± 1323.370op/s 2694094.974op/s 2696112.529op/s 2697083.325op/s 2698084.255op/s 0.20% -0.811 2.596 0.08% 161.936op/s 1 200
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters execution_time 167.656µs 167.967µs ± 0.156µs 167.936µs ± 0.090µs 168.054µs 168.267µs 168.364µs 168.449µs 0.31% 0.735 0.196 0.09% 0.011µs 1 200
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters throughput 5936497.698op/s 5953547.882op/s ± 5539.318op/s 5954645.680op/s ± 3196.505op/s 5956999.194op/s 5961152.982op/s 5963992.087op/s 5964576.795op/s 0.17% -0.730 0.188 0.09% 391.689op/s 1 200
normalization/normalize_service/normalize_service/[empty string] execution_time 36.594µs 36.701µs ± 0.051µs 36.696µs ± 0.029µs 36.730µs 36.777µs 36.867µs 36.966µs 0.74% 1.567 5.617 0.14% 0.004µs 1 200
normalization/normalize_service/normalize_service/[empty string] throughput 27052170.583op/s 27246994.799op/s ± 37958.915op/s 27251233.079op/s ± 21758.707op/s 27271336.682op/s 27295444.318op/s 27319310.077op/s 27326836.431op/s 0.28% -1.545 5.500 0.14% 2684.101op/s 1 200
normalization/normalize_service/normalize_service/test_ASCII execution_time 45.340µs 45.510µs ± 0.127µs 45.509µs ± 0.052µs 45.552µs 45.618µs 45.693µs 46.898µs 3.05% 6.780 70.313 0.28% 0.009µs 1 200
normalization/normalize_service/normalize_service/test_ASCII throughput 21322724.409op/s 21973122.622op/s ± 60234.289op/s 21973847.215op/s ± 24883.167op/s 22003675.470op/s 22032692.817op/s 22051742.704op/s 22055769.238op/s 0.37% -6.563 67.177 0.27% 4259.207op/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.855µs; 495.118µs] or [-0.027%; +0.027%] None None None
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... throughput [2019737.863op/s; 2020792.601op/s] or [-0.026%; +0.026%] None None None
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて execution_time [371.334µs; 371.421µs] or [-0.012%; +0.012%] None None None
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて throughput [2692363.728op/s; 2692998.506op/s] or [-0.012%; +0.012%] None None None
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters execution_time [167.946µs; 167.989µs] or [-0.013%; +0.013%] None None None
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters throughput [5952780.186op/s; 5954315.578op/s] or [-0.013%; +0.013%] None None None
normalization/normalize_service/normalize_service/[empty string] execution_time [36.694µs; 36.708µs] or [-0.019%; +0.019%] None None None
normalization/normalize_service/normalize_service/[empty string] throughput [27241734.058op/s; 27252255.539op/s] or [-0.019%; +0.019%] None None None
normalization/normalize_service/normalize_service/test_ASCII execution_time [45.493µs; 45.528µs] or [-0.039%; +0.039%] None None None
normalization/normalize_service/normalize_service/test_ASCII throughput [21964774.729op/s; 21981470.515op/s] or [-0.038%; +0.038%] None None None

Group 17

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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.763µs 24.914µs ± 8.949µs 18.070µs ± 0.212µs 32.702µs 41.656µs 42.122µs 69.447µs 284.33% 1.117 1.529 35.83% 0.633µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
two way interface execution_time [23.674µs; 26.154µs] or [-4.978%; +4.978%] None None None

Group 18

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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.002µs 5.069µs ± 0.029µs 5.067µs ± 0.021µs 5.091µs 5.110µs 5.114µs 5.119µs 1.02% -0.293 -0.737 0.57% 0.002µ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.065µs; 5.073µs] or [-0.080%; +0.080%] None None None

Group 19

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 74d2641 1771605476 yannham/process-context-sharing
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 84.800µs 85.034µs ± 0.141µs 85.018µs ± 0.048µs 85.072µs 85.182µs 85.280µs 86.523µs 1.77% 6.364 62.628 0.16% 0.010µ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 [85.014µs; 85.053µs] or [-0.023%; +0.023%] None None None

Baseline

Omitted due to size.

@codecov-commenter
Copy link

codecov-commenter commented Feb 19, 2026

Codecov Report

❌ Patch coverage is 69.60784% with 62 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.20%. Comparing base (bf953c0) to head (74d2641).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1585      +/-   ##
==========================================
- Coverage   71.22%   71.20%   -0.03%     
==========================================
  Files         423      424       +1     
  Lines       62130    62376     +246     
==========================================
+ Hits        44253    44415     +162     
- Misses      17877    17961      +84     
Components Coverage Δ
libdd-crashtracker 62.78% <ø> (+0.08%) ⬆️
libdd-crashtracker-ffi 18.30% <ø> (+0.93%) ⬆️
libdd-alloc 98.77% <ø> (ø)
libdd-data-pipeline 87.44% <ø> (+0.52%) ⬆️
libdd-data-pipeline-ffi 73.19% <ø> (-0.37%) ⬇️
libdd-common 79.73% <ø> (-0.44%) ⬇️
libdd-common-ffi 73.40% <ø> (ø)
libdd-telemetry 62.48% <ø> (-0.04%) ⬇️
libdd-telemetry-ffi 16.75% <ø> (ø)
libdd-dogstatsd-client 82.64% <ø> (ø)
datadog-ipc 80.74% <ø> (+0.02%) ⬆️
libdd-profiling 81.55% <ø> (ø)
libdd-profiling-ffi 63.65% <ø> (ø)
datadog-sidecar 33.22% <ø> (-0.43%) ⬇️
datdog-sidecar-ffi 11.41% <ø> (-1.84%) ⬇️
spawn-worker 54.69% <ø> (ø)
libdd-tinybytes 93.16% <ø> (ø)
libdd-trace-normalization 81.71% <ø> (ø)
libdd-trace-obfuscation 94.21% <ø> (ø)
libdd-trace-protobuf 68.00% <ø> (ø)
libdd-trace-utils 89.10% <ø> (+0.01%) ⬆️
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.

@yannham yannham force-pushed the yannham/process-context-sharing branch from 6598cc3 to 43208fe Compare February 19, 2026 17:29
rand = "0.8.3"
rmp = "0.8.14"
rmp-serde = "1.3.0"
rustix = { version = "1.1.3", features = ["param", "mm", "process"] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why rustix rather than the libc crate?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO it's higher-level and a nicer to use than libc (for example memfd_create returns a Result and an RAII file descriptor that is automatically closed upon drop, while the one from libc returns a c_int, etc.). I saw a bunch of occurrences already in Cargo.lock and thought it was pulled already anyway. But upon scrutiny it seems that the 1.1.3 major version bucket is mostly used by tempfile, which is a dev dependency most of the time? So maybe this is actually pulling some additional stuff.

There are a bunch of other dependencies that use the 0.38 version of rustix, so I can also downgrade to this one. But it's just a slight QoL improvement; happy to switch to libc if you think it's better for whatever reason.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth giving a quick check on the size of the resulting builds (I thought we had a github action that posted that but I'm not seeing it?).

In particular, we don't have a specific set target size that we need to stay under, but for many reasons we often have to ship variants so 1 MiB extra does add up if we need to ship e.g. N architectures and M versions.


Having said that, I feel like I'd seen rustix before but hadn't paid a lot of attention to it.

Looking at https://crates.io/crates/rustix it lists that it can work even without libc and that's amazing! If we could drop libc as a dependency from libdatadog would be super-unlock, since one situation where we end up needing to repeat builds is sometimes needing to have builds for both for glibc AND musl.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we could drop libc as a dependency from libdatadog would be super-unlock, since one situation where we end up needing to repeat builds is sometimes needing to have builds for both for glibc AND musl.

That's not really possible, because std uses libc

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not really possible, because std uses libc

Yeah, I know. Rust is very disapponting in this :P

Add an explicit rustix dependency (which was already pulled as a transitive dependency). Prep work for process context sharing.
@yannham yannham force-pushed the yannham/process-context-sharing branch from ed9af88 to fedbeb2 Compare February 20, 2026 15:59
@yannham yannham force-pushed the yannham/process-context-sharing branch from fedbeb2 to 74d2641 Compare February 20, 2026 16:38
Copy link
Member

@ivoanjo ivoanjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a pass on it! Sorry from my part if there is a bit of a confusion with older versions of the spec being implemented, I'll make sure to keep a close eye on the libdatadog impl so it doesn't fall behind while things are still sometimes moving in the spec.

// Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0

//! Implementation of the publisher part of the [process sharing protocol](https://github.com/open-telemetry/opentelemetry-specification/pull/4719)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we already use a lot of name variants internally/informally to refer to this, but if possible, I'd like to use "OTel/OpenTelemetry Process Context" when referring to this in code (so it's easy, to e.g. google it).

Comment on lines +12 to +14
//! Still, we typically want to avoid the compiler and the hardware to re-order the write to the
//! signature (which should be last according to the specification) with the writes to other fields
//! of the header.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: The rest of the comment I think makes sense at the top of the file, but this part I think should live nearer to the actual implementation bits?

Comment on lines +21 to +24
/// Signature bytes for identifying process context mappings
pub const SIGNATURE: &[u8; 8] = b"OTEL_CTX";
/// The discoverable name of the memory mapping.
pub const MAPPING_NAME: &str = "OTEL_CTX";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: These are always expected to match so they can maybe be squeezed into one?

Comment on lines +91 to +92
/// The file descriptor, if the mapping was successfully created from `memfd`.
fd: Option<OwnedFd>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You actually don't need to keep the fd around -- It's expected to close it after the mmap succeeds, that works fine (and one less thing to track ;D )

Comment on lines +61 to +62
/// We use `signature` as a release notification for publication, and `published_at_ns` for
/// updates. Ideally, those should be two `AtomicU64`, but this isn't compatible with
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed this in yesterday's OTel Profiling SIG meeting and I'll go ahead and simplify this soon so that published_at_ns is the notification for both creation and updates. (I'll drop a note on the channel when I do so, so we can update all the impls as needed)

Comment on lines +410 to +418
/// Checks if a mapping line refers to the OTEL_CTX mapping by name
///
/// Handles both anonymous naming (`[anon:OTEL_CTX]`) and memfd naming
/// (`/memfd:OTEL_CTX` which may have ` (deleted)` suffix).
fn is_named_otel_mapping(line: &str) -> bool {
let trimmed = line.trim_end();
trimmed.ends_with("[anon:OTEL_CTX]")
|| trimmed.contains("/memfd:OTEL_CTX")
|| trimmed.contains("memfd:OTEL_CTX")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few notes:

  1. Wait, did you see any variant with memfd that did not start with /memfd?
  2. Rather than mixing ends_with and contains, I suggest always using start_with
  3. There was a slight oversight on my part and I forgot to list a third variant here -- I added it to the spec recently; you can see [anon_shmem:OTEL_CTX] as well (the spec explains when that can happen)

Comment on lines +421 to +424
/// Checks if a mapping line refers to the OTEL_CTX memfd mapping
fn is_memfd_otel_mapping(line: &str) -> bool {
line.contains("/memfd:OTEL_CTX")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: is_named_otel_mapping should be enough for all 3 variants -- no need to separate them out, I think?

Comment on lines +435 to +437
// The atomic alignment constraints are checked during publication.
let signature = unsafe { AtomicU64::from_ptr(ptr).load(Ordering::Acquire) };
&signature.to_ne_bytes() == super::SIGNATURE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably use SeqCst as well (to match my suggestion above)

Comment on lines +448 to +450
if !is_otel_mapping_candidate(&line) {
continue;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer needed (also remnant of older version of spec)

Comment on lines +464 to +469
// For unnamed mappings, verify by reading the signature
if let Some(addr) = parse_mapping_start(&line) {
if verify_signature_at(addr) {
return Ok(addr);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can assume there's always a name now ;)

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.

4 participants