feat(heap-profiling): expose libdatadog heap profiling primitive to users [PROF-15190]#273
Draft
scottgerring wants to merge 1 commit into
Draft
feat(heap-profiling): expose libdatadog heap profiling primitive to users [PROF-15190]#273scottgerring wants to merge 1 commit into
scottgerring wants to merge 1 commit into
Conversation
🎉 All green!🧪 All tests passed 🔗 Commit SHA: a989480 | Docs | Datadog PR Page | Give us feedback! |
There was a problem hiding this comment.
Pull request overview
Adds an opt-in “memory profiling” capability to datadog-opentelemetry by exposing libdatadog’s sampled heap-allocation allocator wrapper behind a feature flag, enabling out-of-process profilers to collect allocation samples via USDT probes.
Changes:
- Introduces a new
memory_profilingmodule that re-exportslibdd_heap_allocator::SampledAllocatorand provides a minimal builder-style opt-in API. - Wires the module behind a new
memory-profilingcrate feature and documents the feature in crate-level docs. - Adds a temporary git dependency on an in-progress
libdatadogbranch and updates the lockfile accordingly.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| datadog-opentelemetry/src/memory_profiling.rs | New public module documenting allocator-based opt-in and providing the builder API. |
| datadog-opentelemetry/src/lib.rs | Documents and conditionally exposes the memory_profiling module + entrypoint under a feature flag. |
| datadog-opentelemetry/Cargo.toml | Adds optional libdd-heap-allocator dependency and memory-profiling feature. |
| Cargo.toml | Adds workspace dependency pointing to a libdatadog git branch for the new allocator crate. |
| Cargo.lock | Locks the newly introduced git-based libdatadog crates and their transitive deps (e.g., bindgen). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+38
to
+40
| # Memory profiling support hasn't landed on libdatadog's main branch yet; | ||
| # point at the in-progress branch until it ships a release. | ||
| libdd-heap-allocator = { git = "https://github.com/DataDog/libdatadog.git", branch = "sgg/heap-prof-poc" } |
Comment on lines
+239
to
+240
| //! * `memory-profiling` enables sampled allocation events for out-of-process | ||
| //! profilers to collect |
592a64d to
a989480
Compare
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.
Warning
This PR is still a draft pending merging of the libdatadog work.
What does this PR do?
The profiling team is adding heap profiling support to libdatadog and the eBPF full host profiler. This works by exposing a USDT behind a sampled allocation path, so that the profiler can hook profiled applications to obtain statistically significant heap samples without having to hook every allocation. In the Rust case, this is supported by providing a
GlobalAllocatorwrapper.Additional Notes
once libdatadog is in, are we happy to merge this into dd-trace-rs (perhaps behind an experimental flag) before we upstream it into the full host profiler, or would we rather carry it on a branch?