prototype(trace-utils): honest-lifetime decoder trait scoped for v1 - #2415
prototype(trace-utils): honest-lifetime decoder trait scoped for v1#2415anais-raison wants to merge 1 commit into
Conversation
Adds DeserializableTraceDataLt<'x>, an additive supertrait of DeserializableTraceData carrying the buffer's genuine lifetime instead of the erased 'static that get_mut_slice/intern_skipped_str report. SliceData<'a> implements it with no unsafe code at all, since Self::Bytes is already &'a [u8] - the exact type the method claims to return. BytesData implements it as 'static, reusing its existing (unsafe) methods unchanged. Scoped to the v1 decoder only: skip_unknown_value/ record_strings_in_value_ref and their v1 callers now require DeserializableTraceDataLt<'x>, giving record_strings_in_value_ref a real lifetime on rmpv::ValueRef instead of a lied 'static. v04/v05 and the original trait/Buffer impl are untouched. Prototype for the follow-up to PR #2295's review discussion. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
📚 Documentation Check Results📦
|
🔒 Cargo Deny Results📦
|
|
BenchmarksComparisonBenchmark execution time: 2026-08-25 16:33:32 Comparing candidate commit 570731f in PR branch Found 4 performance improvements and 1 performance regressions! Performance is the same for 135 metrics, 0 unstable metrics.
|
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
|
What does this PR do?
Adds DeserializableTraceDataLt<'x>, an additive supertrait of DeserializableTraceData carrying the buffer's genuine lifetime instead of the erased 'static that get_mut_slice/intern_skipped_str report. SliceData<'a> implements it with no unsafe code at all, since Self::Bytes is already &'a [u8] - the exact type the method claims to return. BytesData implements it as 'static, reusing its existing (unsafe) methods unchanged.
Scoped to the v1 decoder only: skip_unknown_value/ record_strings_in_value_ref and their v1 callers now require DeserializableTraceDataLt<'x>, giving record_strings_in_value_ref a real lifetime on rmpv::ValueRef instead of a lied 'static. v04/v05 and the original trait/Buffer impl are untouched.
Motivation
Prototype for the follow-up to PR #2295's review discussion.
Additional Notes
Anything else we should know when reviewing?
How to test the change?
Describe here in detail how the change can be validated.