Skip to content

feat(native-spans)!: change buffer foundation#2046

Draft
yannham wants to merge 16 commits into
yannham/span-vec-fields-integrationfrom
yannham/change-buffer-foundation
Draft

feat(native-spans)!: change buffer foundation#2046
yannham wants to merge 16 commits into
yannham/span-vec-fields-integrationfrom
yannham/change-buffer-foundation

Conversation

@yannham
Copy link
Copy Markdown
Contributor

@yannham yannham commented May 27, 2026

What does this PR do?

Add foundation types for dd-trace-js change buffer: buffer, opcodes and trace. Follow up of #2043.

Motivation

See #2022. Required for the integration of native spans into dd-trace-js.

Additional Notes

This PR just introduces the types and doesn't use them yet, hence the allow(unused).

How to test the change?

Unit tests provided.

@yannham yannham changed the title Yannham/change buffer foundation feat(native-spans)!: change buffer foundation May 27, 2026
@datadog-datadog-prod-us1-2
Copy link
Copy Markdown

datadog-datadog-prod-us1-2 Bot commented May 27, 2026

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 13 Pipeline jobs failed

Coverage | coverage   View in Datadog   GitHub Actions

🔧 Fix in code (Fix with Cursor). 1 failed test: assertion 'left == right' failed in datadog-sidecar-ffi/tests/span.rs:191:5

Lint | Presence of licence headers   View in Datadog   GitHub Actions

🔧 Fix in code (Fix with Cursor). License header missing in multiple files: span_header.rs, buffer.rs, mod.rs, utils.rs, operation.rs, trace.rs, build.rs.

Lint | clippy #ubuntu-latest msrv   View in Datadog   GitHub Actions

🔧 Fix in code (Fix with Cursor). Compilation errors due to unused imports and empty lines after outer attributes in libdd-trace-utils/src/change_buffer/mod.rs

View all 13 failed jobs.

🧪 1 Test failed in 1 job

Test | test   GitHub Actions

test_span_debug_log_output from datadog-sidecar-ffi::span   View in Datadog (Fix with Cursor)
thread 'test_span_debug_log_output' panicked at datadog-sidecar-ffi\tests\span.rs:191:5

thread 'test_span_debug_log_output' panicked at datadog-sidecar-ffi\tests\span.rs:191:5:
assertion \`left == right\` failed
  left: [83, 112, 97, 110, 32, 123, 32, 115, 101, 114, 118, 105, 99, 101, 58, 32, 44, 32, 110, 97, 109, 101, 58, 32, 100, 101, 98, 117, 103, 45, 115, 112, 97, 110, 44, 32, 114, 101, 115, 111, 117, 114, 99, 101, 58, 32, 44, 32, 116, 121, 112, 101, 58, 32, 44, 32, 116, 114, 97, 99, 101, 95, 105, 100, 58, 32, 48, 44, 32, 115, 112, 97, 110, 95, 105, 100, 58, 32, 48, 44, 32, 112, 97, 114, 101, 110, 116, 95, 105, 100, 58, 32, 48, 44, 32, 115, 116, 97, 114, 116, 58, 32, 48, 44, 32, 100, 117, 114, 97, 116, 105, 111, 110, 58, 32, 48, 44, 32, 101, 114, 114, 111, 114, 58, 32, 48, 44, 32, 109, 101, 116, 97, 58, 32, 86, 101, 99, 77, 97, 112, 32, 123, 32, 100, 97, 116, 97, 58, 32, 91, 93, 44, 32, 100, 101, 100, 117, 112, 101, 100, 58, 32, 102, 97, 108, 115, 101, 32, 125, 44, 32, 109, 101, 116, 114, 105, 99, 115, 58, 32, 86, 101, 99, 77, 97, 112, 32, 123, 32, 100, 97, 116, 97, 58, 32, 91, 93, 44, 32, 100, 101, 100, 117, 112, 101, 100, 58, 32, 102, 97, 108, 115, 101, 32, 125, 44, 32, 109, 101, 116, 97, 95, 115, 116, 114, 117, 99, 116, 58, 32, 86, 101, 99, 77, 97, 112, 32, 123, 32, 100, 97, 116, 97, 58, 32, 91, 93, 44, 32, 100, 101, 100, 117, 112, 101, 100, 58, 32, 102, 97, 108, 115, 101, 32, 125, 44, 32, 115, 112, 97, 110, 95, 108, 105, 110, 107, 115, 58, 32, 91, 93, 44, 32, 115, 112, 97, 110, 95, 101, 118, 101, 110, 116, 115, 58, 32, 91, 93, 32, 125]
 right: [83, 112, 97, 110, 32, 123, 32, 115, 101, 114, 118, 105, 99, 101, 58, 32, 44, 32, 110, 97, 109, 101, 58, 32, 100, 101, 98, 117, 103, 45, 115, 112, 97, 110, 44, 32, 114, 101, 115, 111, 117, 114, 99, 101, 58, 32, 44, 32, 116, 121, 112, 101, 58, 32, 44, 32, 116, 114, 97, 99, 101, 95, 105, 100, 58, 32, 48, 44, 32, 115, 112, 97, 110, 95, 105, 100, 58, 32, 48, 44, 32, 112, 97, 114, 101, 110, 116, 95, 105, 100, 58, 32, 48, 44, 32, 115, 116, 97, 114, 116, 58, 32, 48, 44, 32, 100, 117, 114, 97, 116, 105, 111, 110, 58, 32, 48, 44, 32, 101, 114, 114, 111, 114, 58, 32, 48, 44, 32, 109, 101, 116, 97, 58, 32, 86, 101, 99, 77, 97, 112, 40, 91, 93, 41, 44, 32, 109, 101, 116, 114, 105, 99, 115, 58, 32, 86, 101, 99, 77, 97, 112, 40, 91, 93, 41, 44, 32, 109, 101, 116, 97, 95, 115, 116, 114, 117, 99, 116, 58, 32, 86, 101, 99, 77, 97, 112, 40, 91, 93, 41, 44, 32, 115, 112, 97, 110, 95, 108, 105, 110, 107, 115, 58, 32, 91, 93, 44, 32, 115, 112, 97, 110, 95, 101, 118, 101, 110, 116, 115, 58, 32, 91, 93, 32, 125]
stack backtrace:
   0:     0x7ff7a0584272 - std::backtrace_rs::backtrace::win64::trace
                               at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
   1:     0x7ff7a0584272 - std::backtrace_rs::backtrace::trace_unsynchronized
...

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

Useful? React with 👍 / 👎

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

@github-actions
Copy link
Copy Markdown
Contributor

Clippy Allow Annotation Report

Comparing clippy allow annotations between branches:

Summary by Rule

Rule Base Branch PR Branch Change

Annotation Counts by File

File Base Branch PR Branch Change

Annotation Stats by Crate

Crate Base Branch PR Branch Change
clippy-annotation-reporter 5 5 No change (0%)
datadog-ffe-ffi 1 1 No change (0%)
datadog-ipc 21 21 No change (0%)
datadog-live-debugger 6 6 No change (0%)
datadog-live-debugger-ffi 10 10 No change (0%)
datadog-profiling-replayer 4 4 No change (0%)
datadog-remote-config 3 3 No change (0%)
datadog-sidecar 57 57 No change (0%)
libdd-common 13 13 No change (0%)
libdd-common-ffi 12 12 No change (0%)
libdd-data-pipeline 5 5 No change (0%)
libdd-ddsketch 2 2 No change (0%)
libdd-dogstatsd-client 1 1 No change (0%)
libdd-profiling 13 13 No change (0%)
libdd-telemetry 20 20 No change (0%)
libdd-tinybytes 4 4 No change (0%)
libdd-trace-normalization 2 2 No change (0%)
libdd-trace-obfuscation 3 3 No change (0%)
libdd-trace-stats 1 1 No change (0%)
libdd-trace-utils 13 13 No change (0%)
Total 196 196 No change (0%)

About This Report

This 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-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.87307% with 107 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.91%. Comparing base (95d3d03) to head (8962592).

Additional details and impacted files
@@                           Coverage Diff                           @@
##           yannham/span-vec-fields-integration    #2046      +/-   ##
=======================================================================
+ Coverage                                72.77%   72.91%   +0.14%     
=======================================================================
  Files                                      459      464       +5     
  Lines                                    76037    76360     +323     
=======================================================================
+ Hits                                     55335    55678     +343     
+ Misses                                   20702    20682      -20     
Components Coverage Δ
libdd-crashtracker 65.43% <ø> (+0.22%) ⬆️
libdd-crashtracker-ffi 38.78% <ø> (+1.95%) ⬆️
libdd-alloc 98.77% <ø> (ø)
libdd-data-pipeline 85.85% <ø> (+0.58%) ⬆️
libdd-data-pipeline-ffi 73.93% <ø> (+3.41%) ⬆️
libdd-common 79.89% <ø> (ø)
libdd-common-ffi 74.41% <ø> (ø)
libdd-telemetry 73.34% <ø> (-0.03%) ⬇️
libdd-telemetry-ffi 31.36% <ø> (ø)
libdd-dogstatsd-client 82.64% <ø> (ø)
datadog-ipc 76.22% <ø> (ø)
libdd-profiling 81.69% <ø> (ø)
libdd-profiling-ffi 64.79% <ø> (ø)
libdd-sampling 97.46% <ø> (ø)
datadog-sidecar 30.22% <ø> (+1.24%) ⬆️
datdog-sidecar-ffi 15.32% <ø> (+6.08%) ⬆️
spawn-worker 48.86% <ø> (ø)
libdd-tinybytes 93.16% <ø> (ø)
libdd-trace-normalization 81.71% <ø> (ø)
libdd-trace-obfuscation 87.30% <ø> (ø)
libdd-trace-protobuf 68.25% <ø> (ø)
libdd-trace-utils 87.95% <66.87%> (-0.84%) ⬇️
libdd-tracer-flare 86.88% <ø> (ø)
libdd-log 74.83% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented May 27, 2026

Artifact Size Benchmark Report

aarch64-alpine-linux-musl
Artifact Baseline Commit Change
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 7.57 MB 7.57 MB 0% (0 B) 👌
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.a 82.02 MB 81.85 MB --.20% (-170.28 KB) 💪
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.17 MB 10.17 MB -0% (-608 B) 👌
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 93.08 MB 92.91 MB --.18% (-172.33 KB) 💪
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 24.31 MB 24.29 MB --.08% (-21.00 KB) 💪
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 81.48 KB 81.48 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 177.00 MB 176.90 MB --.05% (-104.00 KB) 💪
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 911.16 MB 910.78 MB --.04% (-390.42 KB) 💪
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 7.91 MB 7.90 MB --.09% (-7.50 KB) 💪
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 81.48 KB 81.48 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 23.49 MB 23.44 MB --.19% (-48.00 KB) 💪
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 46.91 MB 46.85 MB --.12% (-58.28 KB) 💪
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 21.04 MB 21.02 MB --.07% (-15.50 KB) 💪
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 82.76 KB 82.76 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 180.83 MB 180.73 MB --.06% (-112.00 KB) 💪
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 904.36 MB 904.01 MB --.03% (-362.59 KB) 💪
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 6.12 MB 6.11 MB --.15% (-10.00 KB) 💪
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 82.76 KB 82.76 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 25.19 MB 25.13 MB --.21% (-56.00 KB) 💪
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 44.61 MB 44.55 MB --.13% (-61.66 KB) 💪
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 73.12 MB 72.98 MB --.19% (-143.08 KB) 💪
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 8.44 MB 8.43 MB --.09% (-8.00 KB) 💪
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 88.53 MB 88.38 MB --.16% (-153.95 KB) 💪
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.27 MB 10.26 MB --.11% (-11.86 KB) 💪

yannham and others added 9 commits May 27, 2026 13:59
The trace_buffer benchmark was still using HashMap for Span meta,
metrics, and meta_struct fields after the VecMap migration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The decoder functions were returning Vec<(K, V)> which callers
immediately converted to VecMap via .into(). Return VecMap directly
to avoid the unnecessary intermediate type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add the supporting types for the change-buffer module behind
a `change-buffer` feature flag: ChangeBuffer (raw memory wrapper),
OpCode/BufferedOperation, SpanHeader (repr(C)), SmallTraceMap,
Trace, and error types. These are the building blocks for
ChangeBufferState which follows in the next commit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@yannham yannham force-pushed the yannham/change-buffer-foundation branch from 8962592 to 66fb3e6 Compare May 27, 2026 12:13
@yannham yannham force-pushed the yannham/span-vec-fields-integration branch 3 times, most recently from 2d45a7f to 8f43f82 Compare May 27, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants