feat: cross-platform named shared memory primitives#1786
Draft
khanayan123 wants to merge 2 commits intomainfrom
Draft
feat: cross-platform named shared memory primitives#1786khanayan123 wants to merge 2 commits intomainfrom
khanayan123 wants to merge 2 commits intomainfrom
Conversation
Add two new crates for propagating stable session identifiers across process boundaries via named shared memory: - datadog-session-id: Rust library built on datadog-ipc's NamedShmHandle (shm_open/memfd on Unix, CreateFileMapping on Windows) - datadog-session-id-ffi: C FFI exposing ddog_session_create, ddog_session_read_parent, ddog_session_read_pid, and ddog_session_carrier_drop SDKs that link against libdatadog can use the FFI to create/read session carriers without platform-specific shared memory code. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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. |
Replace the session-ID-specific crates with generic shared memory building blocks: - datadog-shm: ShmWriter (create/update) and ShmReader (open/read) backed by datadog-ipc's NamedShmHandle (shm_open on Unix, CreateFileMapping on Windows). Also provides PID-keyed convenience helpers and parent_pid() cross-platform. - datadog-shm-ffi: C FFI surface (ddog_shm_create, ddog_shm_open, ddog_shm_read_data, ddog_shm_update, ddog_shm_create_pid_keyed, ddog_shm_open_pid_keyed, etc.) Session IDs, config snapshots, or any other small blob can now be shared across processes through a single, reusable API. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: aea39d9 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
Contributor
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
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
datadog-shmcrate: generic cross-platform named shared memory primitives built ondatadog-ipc'sNamedShmHandle(shm_open/memfdon Unix,CreateFileMappingon Windows)ShmWriter— create a named segment, write bytes, update in-placeShmReader— open an existing segment by name, read bytescreate_pid_keyed/open_pid_keyed) plus cross-platformparent_pid()datadog-shm-fficrate: C FFI surface for SDKs that link libdatadogddog_shm_create/ddog_shm_open/ddog_shm_read_data/ddog_shm_update/ddog_shm_writer_drop/ddog_shm_reader_dropddog_shm_create_pid_keyed/ddog_shm_open_pid_keyed/ddog_shm_current_pid/ddog_shm_parent_pidContext
Part of the Stable Service Instance Identifier initiative. This provides a thin, reusable module that any SDK can use to share small data blobs (session IDs, config snapshots, status) across process boundaries via named SHM.
SDKs that depend on libdatadog (PHP, Ruby, .NET, Python, Node.js) call the FFI. SDKs without libdatadog (Go, Java, C++) implement their own equivalents using the same naming convention (
/dd-<prefix>-<pid>).Test plan
CreateFileMappingviaNamedShmHandle— no new platform code)🤖 Generated with Claude Code