Skip to content

feat(heap-profiling): expose libdatadog heap profiling primitive to users [PROF-15190]#273

Draft
scottgerring wants to merge 1 commit into
mainfrom
sgg/heap-prof-poc
Draft

feat(heap-profiling): expose libdatadog heap profiling primitive to users [PROF-15190]#273
scottgerring wants to merge 1 commit into
mainfrom
sgg/heap-prof-poc

Conversation

@scottgerring

Copy link
Copy Markdown
Member

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 GlobalAllocator wrapper.

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?

@datadog-prod-us1-6

datadog-prod-us1-6 Bot commented Jul 3, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: a989480 | Docs | Datadog PR Page | Give us feedback!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_profiling module that re-exports libdd_heap_allocator::SampledAllocator and provides a minimal builder-style opt-in API.
  • Wires the module behind a new memory-profiling crate feature and documents the feature in crate-level docs.
  • Adds a temporary git dependency on an in-progress libdatadog branch 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 thread Cargo.toml
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 thread datadog-opentelemetry/src/lib.rs Outdated
Comment on lines +239 to +240
//! * `memory-profiling` enables sampled allocation events for out-of-process
//! profilers to collect
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.

2 participants