Conversation
ddprof uses "tracepoint"/"events" as the sample type for hardware
counters and perf tracepoint events. The v28 enum-based SampleType API
had no equivalent, causing those profiles to fall back to "sample"/"count"
and breaking the Datadog backend rendering.
Add `SampleType::Tracepoint` mapping to `ValueType::new("tracepoint", "events")`.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add `ddog_prof_SampleType_type_str` and `ddog_prof_SampleType_unit_str` functions that return the pprof column name strings (e.g. "cpu-time", "nanoseconds") for a given SampleType enum value. This allows consumers to verify or log the exact strings that libdatadog writes into pprof profiles, without maintaining their own mapping table that can drift out of sync. Co-Authored-By: Claude Sonnet 4.6 <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. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1678 +/- ##
==========================================
+ Coverage 71.17% 71.18% +0.01%
==========================================
Files 427 427
Lines 62807 62838 +31
==========================================
+ Hits 44703 44733 +30
- Misses 18104 18105 +1
🚀 New features to boost your workflow:
|
📚 Documentation Check Results📦
|
BenchmarksComparisonBenchmark execution time: 2026-03-06 10:55:43 Comparing candidate commit 383bbf9 in PR branch Found 0 performance improvements and 2 performance regressions! Performance is the same for 55 metrics, 2 unstable metrics. scenario:credit_card/is_card_number/ 378282246310005
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. |
🔒 Cargo Deny Results✅ No issues found! 📦
|
TBH, changing this is a very big thing, so I do think it shouldn't be something that happens silently because the tests silently pick up the new name on it. I think forcing a big search/replace when updating libdatadog if the profile type changes is actually a very loud way of making sure we're happy with such a change. (So I actually kinda think this API is not that valuable) |
OK, I actually had static asserts on my side, so I'm agreeing already with this. |
What does this PR do?
Adds two C FFI functions that expose the pprof type and unit strings for a given ddog_prof_SampleType enum value:
Both return static string slices that are always valid and never need to be freed.
Motivation
Consumers of ddog_prof_SampleType (such as ddprof) need to know the exact pprof column name strings that libdatadog writes into profiles — for debug logging, integration tests, and static verification.
Without this API, they must maintain their own mapping table that can silently drift out of sync with libdatadog's internal Rust implementation.
Additional Notes
This PR is stacked on #1676 (feat(profiling)!: add Tracepoint sample type) due to the test covering SampleType::Tracepoint. It should be rebased onto main once that PR merges.
The returned slices point into static string literals defined in sample_type.rs — they have 'static lifetime and are safe to use without copying.
How to test the change?
The new sample_type_str_functions test in libdd-profiling-ffi/src/profiles/datatypes.rs covers all common sample types and verifies both the type and unit strings match expected values:
cargo test -p libdd-profiling-ffi -- sample_type_str