feat(profiling)!: add gc-time sample type - #2442
Conversation
Map to pprof ("gc-time", "nanoseconds") and ("gc-samples", "count") so
language tracers can export exact GC pause events on a first-class
value type instead of experimental slots.
📚 Documentation Check Results📦
|
🔒 Cargo Deny Results📦
|
BenchmarksComparisonCandidateCandidate benchmark detailsBaselineBaseline benchmark details |
|
✅ All CI checks and tests passed. 🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: b92c672 | Docs | View more details | Give us feedback! |
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
|
There was a problem hiding this comment.
🟢 Approval recommended
The new enum variants are consistently implemented across Rust API conversions and the CXX bridge, and existing round-trip tests will automatically cover the added variants.
Pull request overview
Adds two new first-class GC-related sample types to libdd-profiling’s public SampleType enum and wires them through the existing Rust ↔︎ ValueType conversion layer and the CXX bridge, enabling downstream tracers to emit GC pause metrics with explicit type/unit semantics.
Changes:
- Extend
api::SampleTypewithGcTimeandGcSamples. - Map the new variants to/from pprof
(type, unit)pairs:("gc-time","nanoseconds")and("gc-samples","count"). - Extend the CXX FFI
SampleTypeenum and its conversion intoapi::SampleTypeto support round-tripping across the bridge.
File summaries
| File | Description |
|---|---|
| libdd-profiling/src/cxx.rs | Adds GcTime/GcSamples to the CXX bridge SampleType and maps them into api::SampleType. |
| libdd-profiling/src/api/sample_type.rs | Adds GcTime/GcSamples variants and updates SampleType ↔︎ ValueType encoding/decoding (and round-trip test coverage via enum iteration). |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
What does this PR do?
Adds first-class
GcTime/GcSamplestoSampleType(Rust + CXX FFI):GcTime→("gc-time", "nanoseconds")GcSamples→("gc-samples", "count")(same pairing as wall/cpu)Encode and decode both ways. House round-trip test covers the new variants. C headers are generated from
cxx.rsin CI.If this merges and nothing else lands: the type exists in libdatadog. No tracer emits it. No intake/CompView listing.
SampleType+ FFIpush_*Motivation
DataDog/dd-trace-py#19940 piggybacks GC pauses on wall-time (default-off). It stays that way until this type exists here and the tracer can
push_*it.Additional Notes
Timeline (STW) and intake/CompView
availableProfileTypesare follow-up. Not eBPF, not DogStatsD, not T #19190 CPU leaf frames. Frames staygc.collect[gen=N].BREAKING CHANGE: additive variants on a public exhaustive
SampleTypeenum. Existing discriminants unchanged (appended afterCustom5).How to test the change?
cargo test -p libdd-profiling --lib api::sample_type