Conversation
Add an explicit rustix dependency (which was already pulled as a transitive dependency). Prep work for process context sharing.
📚 Documentation Check Results✅ No documentation warnings found! 📦
|
Clippy Allow Annotation ReportComparing clippy allow annotations between branches:
Summary by Rule
Annotation Counts by File
Annotation Stats by Crate
About This ReportThis 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. |
🔒 Cargo Deny Results✅ No issues found! 📦
|
BenchmarksComparisonBenchmark execution time: 2026-02-19 17:48:12 Comparing candidate commit 43208fe in PR branch Found 1 performance improvements and 0 performance regressions! Performance is the same for 56 metrics, 2 unstable metrics. scenario:profile_add_sample2_frames_x1000
CandidateCandidate benchmark detailsGroup 1
Group 2
Group 3
Group 4
Group 5
Group 6
Group 7
Group 8
Group 9
Group 10
Group 11
Group 12
Group 13
Group 14
Group 15
Group 16
Group 17
Group 18
Group 19
BaselineOmitted due to size. |
05a3bcd to
6598cc3
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1585 +/- ##
==========================================
+ Coverage 70.82% 71.05% +0.22%
==========================================
Files 423 424 +1
Lines 61862 62139 +277
==========================================
+ Hits 43816 44153 +337
+ Misses 18046 17986 -60
🚀 New features to boost your workflow:
|
6598cc3 to
43208fe
Compare
| } | ||
|
|
||
| /// Locks the context handle. Returns a uniform error if the lock has been poisoned. | ||
| fn lock_context_handle<'a>() -> anyhow::Result<MutexGuard<'a, Option<ProcessContextHandle>>> { |
There was a problem hiding this comment.
I think this is equivalent to this, since the lifetime is unbounded https://doc.rust-lang.org/nomicon/unbounded-lifetimes.html
| fn lock_context_handle<'a>() -> anyhow::Result<MutexGuard<'a, Option<ProcessContextHandle>>> { | |
| fn lock_context_handle() -> anyhow::Result<MutexGuard<'static, Option<ProcessContextHandle>>> { |
| rand = "0.8.3" | ||
| rmp = "0.8.14" | ||
| rmp-serde = "1.3.0" | ||
| rustix = { version = "1.1.3", features = ["param", "mm", "process"] } |
There was a problem hiding this comment.
why rustix rather than the libc crate?
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:
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:
rustixfor that since it's already pulled as a transitive dependency (with the same major version bucket), and is nicely higher-level thanlibc.MemFdwrapper crate used (e.g herelibdatadog/libdd-library-config/src/tracer_metadata.rs
Line 54 in 0bd90fd
There are a number of design choices or assumptions that might be interesting to discuss further:
/proc/<pid>/mapsand 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).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