Skip to content

feat(trace-utils)!: add v1 decoder#2174

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 43 commits into
mainfrom
anais/add-v1-decoder
Jul 17, 2026
Merged

feat(trace-utils)!: add v1 decoder#2174
gh-worker-dd-mergequeue-cf854d[bot] merged 43 commits into
mainfrom
anais/add-v1-decoder

Conversation

@anais-raison

@anais-raison anais-raison commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a V1 msgpack decoder in libdd-trace-utils and wires the V1 variant through the trace pipeline so any V1 payload can be decoded, inspected, and re-encoded.

Motivation

APMSP-2813 : Prerequisite for the sidecar V1-native path. Splitting out the libdd-trace-utils / libdd-data-pipeline plumbing so it can land before the sidecar wiring.

Additional Notes

  • Mirrors the existing v04 decoder structure.
  • trace_serializer.rs now dispatches on (TraceChunks, OutputFormat); the existing v0.4 → V1 cross-encode path is preserved.
  • trace_utils::collect_trace_chunks renamed to convert_trace_chunks_v04_to_v05.

⚠️ You can focus on those folders/files only as I merged the others from the PR #2145 to get all the refactors:

  • libdd-data-pipeline/src/trace_exporter/trace_serializer.rs
  • libdd-trace-utils/src/msgpack_decoder/
  • libdd-trace-utils/src/span/mod.rs
  • libdd-trace-utils/src/span/vec_map.rs
  • libdd-trace-utils/src/trace_utils.rs
  • libdd-trace-utils/src/tracer_payload.rs
  • libdd-trace-utils/tests/snapshots/compare_v1_full_payload_snapshot_test.json
  • libdd-trace-utils/tests/test_send_data.rs

@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Clippy Allow Annotation Report

Tracked Clippy allow annotations changed vs main: ⚠️ +1 (8 → 9)

Rule Base PR Δ
unwrap_used 5 6 ⚠️ +1
By file and crate

By file

File Base PR Δ
libdd-trace-utils/src/send_data/mod.rs 5 6 ⚠️ +1

By crate

Crate Base PR Δ
libdd-trace-utils 11 12 ⚠️ +1

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. Panic-inducing macros in particular should be avoided. In the future, this report may become a PR-blocking quality gate.

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jun 29, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 62.75%
Overall Coverage: 74.60% (-0.12%)

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

@dd-octo-sts

dd-octo-sts Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Artifact Size Benchmark Report

aarch64-alpine-linux-musl
Artifact Baseline Commit Change
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.a 86.33 MB 86.47 MB +.16% (+142.10 KB) 🔍
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 7.88 MB 7.95 MB +.79% (+64.00 KB) 🔍
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.62 MB 10.69 MB +.62% (+68.00 KB) 🔍
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 97.54 MB 97.68 MB +.13% (+139.10 KB) 🔍
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 25.58 MB 25.62 MB +.15% (+41.50 KB) 🔍
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 89.18 KB 89.18 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 185.54 MB 186.35 MB +.43% (+832.00 KB) 🔍
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 958.60 MB 962.77 MB +.43% (+4.16 MB) 🔍
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 8.37 MB 8.38 MB +.12% (+10.50 KB) 🔍
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 89.18 KB 89.18 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 24.76 MB 24.80 MB +.15% (+40.00 KB) 🔍
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 49.28 MB 49.36 MB +.15% (+76.58 KB) 🔍
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 22.23 MB 22.27 MB +.16% (+38.50 KB) 🔍
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 90.58 KB 90.58 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 190.01 MB 190.80 MB +.41% (+808.00 KB) 🔍
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 946.54 MB 950.99 MB +.47% (+4.45 MB) 🔍
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 6.47 MB 6.48 MB +.12% (+8.50 KB) 🔍
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 90.58 KB 90.58 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 26.58 MB 26.62 MB +.14% (+40.00 KB) 🔍
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 46.89 MB 46.97 MB +.15% (+74.75 KB) 🔍
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 77.08 MB 77.21 MB +.16% (+131.85 KB) 🔍
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 8.83 MB 8.84 MB +.13% (+12.00 KB) 🔍
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 92.50 MB 92.63 MB +.14% (+137.35 KB) 🔍
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.74 MB 10.75 MB +.10% (+11.68 KB) 🔍

@anais-raison
anais-raison marked this pull request as ready for review June 29, 2026 17:54
@anais-raison
anais-raison requested review from a team as code owners June 29, 2026 17:54

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5434161c71

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread libdd-trace-utils/src/tracer_payload.rs Outdated
Comment thread libdd-trace-utils/src/msgpack_decoder/v1/mod.rs Outdated
Comment thread libdd-trace-utils/src/tracer_payload.rs
Comment thread libdd-trace-utils/src/msgpack_decoder/v1/span.rs Outdated
Comment thread libdd-trace-utils/src/msgpack_decoder/v1/span.rs Outdated
Comment thread libdd-trace-utils/src/msgpack_decoder/v1/span.rs Outdated
@anais-raison anais-raison changed the title feat: add v1 decoder feat(trace-utils)!: add v1 decoder Jun 29, 2026

@ajgajg1134 ajgajg1134 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing we can do here to build confidence in the decoder is take the working dd-trace-go implementation and generate a bunch of various traces and put them just in to flat files, then decode them with this implementation and the trace-agent implementation to make sure they align? (Maybe there's an easier way to check this though)

Comment thread libdd-trace-utils/src/msgpack_decoder/v1/mod.rs Outdated
Comment thread libdd-trace-utils/src/msgpack_decoder/v1/mod.rs
Comment thread libdd-trace-utils/src/send_data/mod.rs

@ekump ekump left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving as none of my suggestions are blocking. But, I think mine, @Aaalibaba42 and @yannham's suggestions are simple enough that they can be addressed before merging and will improve the decoder.

Comment thread libdd-trace-utils/src/msgpack_decoder/v1/mod.rs Outdated
Comment thread libdd-trace-utils/src/msgpack_decoder/v1/mod.rs Outdated
Comment thread libdd-trace-utils/src/msgpack_decoder/v1/mod.rs Outdated
Comment thread libdd-trace-utils/src/msgpack_decoder/v1/span.rs
Comment thread libdd-trace-utils/src/msgpack_decoder/v1/span.rs Outdated
@anais-raison
anais-raison changed the base branch from main to anais/encoder-v1-to-v04-and-refacto-2 July 13, 2026 09:13
…cto-2' into anais/add-v1-decoder

# Conflicts:
#	libdd-trace-utils/src/tracer_payload.rs
@github-actions github-actions Bot removed the sidecar label Jul 13, 2026
@pr-commenter

pr-commenter Bot commented Jul 13, 2026

Copy link
Copy Markdown

Benchmarks

Comparison

Benchmark execution time: 2026-07-20 09:49:24

Comparing candidate commit a2fbd74 in PR branch anais/add-v1-decoder with baseline commit d7980db in branch main.

Found 1 performance improvements and 2 performance regressions! Performance is the same for 136 metrics, 0 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:msgpack_decoder::v05/high_sharing/2000

  • 🟥 execution_time [+76.140µs; +76.644µs] or [+4.895%; +4.928%]
  • 🟥 throughput [-60392.305op/s; -60000.522op/s] or [-4.697%; -4.666%]

scenario:vec_map/as_deduped_map/needs_dedup_1_in_10/8

  • 🟩 execution_time [-18.720ns; -18.572ns] or [-5.039%; -4.999%]

Benchmark execution time: 2026-07-20 09:48:12

Comparing candidate commit a2fbd74 in PR branch anais/add-v1-decoder with baseline commit d7980db in branch main.

Found 3 performance improvements and 0 performance regressions! Performance is the same for 72 metrics, 10 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:datadog_sample_span/service_rule_not_matching/wall_time

  • 🟩 execution_time [-10.624ns; -10.364ns] or [-7.540%; -7.355%]

scenario:trace_buffer/2_senders/no_delay

  • 🟩 execution_time [-68.468µs; -61.421µs] or [-7.270%; -6.522%]
  • 🟩 throughput [+134137.588op/s; +149673.874op/s] or [+7.016%; +7.828%]

Candidate

Omitted due to size.

Baseline

Omitted due to size.

Base automatically changed from anais/encoder-v1-to-v04-and-refacto-2 to main July 15, 2026 14:28
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot requested a review from a team as a code owner July 15, 2026 14:28
anais-raison and others added 5 commits July 15, 2026 17:08
# Conflicts:
#	libdd-data-pipeline/src/trace_exporter/trace_serializer.rs
#	libdd-trace-utils/tests/test_send_data.rs
@gh-worker-ownership-write-b05516
gh-worker-ownership-write-b05516 Bot removed the request for review from a team July 17, 2026 12:50

@ajgajg1134 ajgajg1134 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a V1 perspective this looks good! (And I saw some new rust things I don't see often so that was cool 😎 )

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.

6 participants