feat(data-pipeline): set structured span values - #2300
Draft
lloeki wants to merge 1 commit into
Draft
Conversation
Add a span setter that accepts structured-value tokens and encodes them directly into `meta_struct`. Native tracers can populate structured metadata without managing an intermediate encoded blob or paying an additional value copy. Validate the key and complete token stream before replacing an existing entry. Encoding failures and invalid handles therefore leave the span unchanged.
Contributor
📚 Documentation Check Results📦
|
Contributor
🔒 Cargo Deny Results📦
|
BenchmarksComparisonCandidateCandidate benchmark detailsBaselineBaseline benchmark details |
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: bad622f | Docs | Datadog PR Page | Give us feedback! |
Contributor
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
|
Member
Author
|
Draft dd-trace-rb example consumer: DataDog/dd-trace-rb#6133. |
lloeki
force-pushed
the
lloeki/native-meta-struct-m2
branch
from
July 30, 2026 12:03
c402ab6 to
1c4db0d
Compare
lloeki
force-pushed
the
lloeki/native-meta-struct-m3
branch
from
July 30, 2026 12:03
d8dad0b to
bad622f
Compare
This was referenced Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI-generated code disclosure: this PR was implemented with substantial AI assistance and manually reviewed and validated.
What does this PR do?
Adds direct structured-value insertion into
TracerSpan.meta_struct, reusing the validator and encoder from DataDog/libdatadog PR 2304 while moving the encoded allocation directly into the span. The opaque blob and standalone encoder APIs remain available.Motivation
The standalone encoder still requires consumers to manage an intermediate encoded blob and an additional value copy. The direct setter provides the final efficient API for structured payload parity tracked by APMSP-3219.
Additional Notes
Stack position: L5, current PR: DataDog/libdatadog PR 2300, stacked on L4 DataDog/libdatadog PR 2304.
Complete expected review and merge order for one libdatadog release:
L0-L3 are independent and can be reviewed in parallel. Merging them in the listed order is still recommended because it reduces integration and release-branch conflicts, and lands panic containment before the new payload surfaces. L4 is stacked on L1, and L5 is stacked on L4.
This PR remains a draft because its review and final rebase depend on L4 and, transitively, L1. Its matching consumer DataDog/dd-trace-rb PR 6133 is also a draft pending this API and the single libdatadog/libdatadog-rb release. L4 remains draft until L1 is ready.
L0 tracks APMSP-3830; L1-L5 implement the payload work tracked by APMSP-3219.
How to test the change?
Prior local validation completed successfully:
nix develop --command cargo test -p libdd-data-pipeline-ffi --lockedpassed 68 tests, including direct-setter/standalone-encoder equivalence, atomic failure, invalid handles, overwrite behaviour, and ownership.nix develop --command cargo clippy -p libdd-data-pipeline-ffi --all-targets --locked -- -D warningspassed.nix develop .#nightly --command cargo fmt --all -- --checkpassed.nix develop -c cargo run --bin release -- --out /tmp/opencode/libdatadog-m3/x86_64-linux.nix develop .#ruby40 --command nix shell nixpkgs#valgrind --command bundle exec ruby_memcheck vendor/bundle/ruby/4.0.0/gems/rspec-core-3.13.6/exe/rspec spec/datadog/tracing/transport/native/tracer_span_spec.rb spec/datadog/tracing/transport/native/send_traces_spec.rb spec/datadog/tracing/transport/native/trace_exporter_spec.rbpassed with no Valgrind memory errors.