chore(otel-process-ctx): migrate from rustix to libc#1859
chore(otel-process-ctx): migrate from rustix to libc#1859
Conversation
📚 Documentation Check Results📦
|
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! 📦
|
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 7b0145f | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1859 +/- ##
==========================================
- Coverage 71.70% 71.67% -0.04%
==========================================
Files 429 429
Lines 67887 67913 +26
==========================================
- Hits 48681 48678 -3
- Misses 19206 19235 +29
🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fc09061 to
60d6541
Compare
…d glibc libc::memfd_create requires glibc >= 2.27, causing a link error on CentOS 7 (glibc 2.17). Use libc::syscall(SYS_memfd_create, ...) instead, which bypasses the glibc wrapper and works with any glibc version, matching the previous rustix behavior. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
d41d013 to
962448b
Compare
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-unknown-linux-gnu
|
ivoanjo
left a comment
There was a problem hiding this comment.
👍 As a fellow lover of clear code and good abstractions I feel the pain lol. This looks good -- might be worth having a fellow rustacean do a quick extra pass just in case I missed some subtle detail.
Aaalibaba42
left a comment
There was a problem hiding this comment.
nit: Maybe check_syscall_retval could be a macro
lgtm
I hesitated to just wrap syscalls in it, instead of retrieving |
| Ok(unsafe { OwnedFd::from_raw_fd(fd) }) | ||
| } | ||
|
|
||
| // Whether this size depends on the page size or not in the future, Rustix's `page_size()` |
There was a problem hiding this comment.
Is this comment mentioning rustix relevant?
There was a problem hiding this comment.
It's not (and wasn't even before this PR), thanks for the catch!
| pub const SIGNATURE: &[u8; 8] = b"OTEL_CTX"; | ||
| /// The discoverable name of the memory mapping. | ||
| pub const MAPPING_NAME: &str = "OTEL_CTX"; | ||
| pub const MAPPING_NAME: &CStr = c"OTEL_CTX"; |
There was a problem hiding this comment.
🔥 didn't know this was possible
What does this PR do?
Migrates the
otel_process_ctxmodule inlibdd-library-configfromrustixtolibc, removing therustixdependency from that crate entirely.Motivation
rustixuses the vDSO for some syscalls, which makes Valgrind chokes. This makes tests fail on the dd-trace-rb repo.Additionally, while rustix offers a nice high-level API, this crate was the only one to use it as a direct dependency. While we may decide later to move toward rustix, I think this should be global to libdatadog, and not a per-crate choices (barring specifc situations/reasons). The change isn't too painful either.
Additional Notes
N/A
How to test the change?
N/A