Skip to content

refactor(trace-utils): replace use_v05_format bool and remove infallible expect#1946

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 5 commits into
mainfrom
anais/use-v05-format-refacto
May 26, 2026
Merged

refactor(trace-utils): replace use_v05_format bool and remove infallible expect#1946
gh-worker-dd-mergequeue-cf854d[bot] merged 5 commits into
mainfrom
anais/use-v05-format-refacto

Conversation

@anais-raison

Copy link
Copy Markdown
Contributor

What does this PR do?

Replaces the use_v05_format: bool parameter in collect_trace_chunks with the existing TraceEncoding enum, and removes #[allow(clippy::expect_used)] + .expect("infallible...") in the v04 msgpack encoder.

Motivation

Follow-up to #1896, addressing review comments:

  • Passing a bare bool to collect_trace_chunks gave no context at the call site — you had to look up the function signature to understand what true/false meant. Using TraceEncoding makes the intent explicit.
  • The collect_and_process_traces match had a catch-all arm that computed a bool from the format — replaced with exhaustive V04/V05 arms.
  • The v04 encoder used .expect("infallible...") with a clippy allow to handle an error that can never occur. Replaced with let _ = ..., consistent with what was already done in the v1 encoder.

Additional Notes

⚠️ Should be merged after #1896.

How to test the change?

Existing tests.

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

Clippy Allow Annotation Report

Comparing clippy allow annotations between branches:

  • Base Branch: origin/main
  • PR Branch: origin/anais/use-v05-format-refacto

Summary by Rule

Rule Base Branch PR Branch Change
expect_used 2 0 ✅ -2 (-100.0%)
todo 2 2 No change (0%)
unimplemented 1 1 No change (0%)
unwrap_used 6 6 No change (0%)
Total 11 9 ✅ -2 (-18.2%)

Annotation Counts by File

File Base Branch PR Branch Change
libdd-common/src/lib.rs 6 6 No change (0%)
libdd-trace-utils/src/msgpack_encoder/v04/mod.rs 2 0 ✅ -2 (-100.0%)
libdd-trace-utils/src/trace_utils.rs 2 2 No change (0%)
libdd-trace-utils/src/tracer_payload.rs 1 1 No change (0%)

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 15 13 ✅ -2 (-13.3%)
Total 198 196 ✅ -2 (-1.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.

@datadog-official

datadog-official Bot commented May 5, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 85.19%
Overall Coverage: 72.77% (+0.02%)

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

@dd-octo-sts

dd-octo-sts Bot commented May 5, 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 82.01 MB 82.02 MB +.01% (+11.15 KB) 🔍
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 7.57 MB 7.57 MB 0% (0 B) 👌
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 93.07 MB 93.08 MB +.01% (+10.98 KB) 🔍
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.17 MB 10.17 MB +0% (+96 B) 👌
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 24.31 MB 24.31 MB +.02% (+5.50 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 176.90 MB 176.99 MB +.05% (+96.00 KB) 🔍
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 910.53 MB 911.16 MB +.06% (+646.22 KB) 🔍
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 7.91 MB 7.91 MB --.01% (-1.00 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.49 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 46.91 MB 46.91 MB +0% (+3.63 KB) 👌
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 21.03 MB 21.04 MB +.02% (+5.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.73 MB 180.83 MB +.05% (+104.00 KB) 🔍
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 903.74 MB 904.36 MB +.06% (+636.01 KB) 🔍
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 6.12 MB 6.12 MB -0% (-512 B) 👌
/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.19 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 44.60 MB 44.61 MB +0% (+2.80 KB) 👌
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 73.11 MB 73.12 MB +.01% (+14.44 KB) 🔍
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 8.45 MB 8.44 MB --.04% (-4.00 KB) 💪
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 88.51 MB 88.53 MB +.01% (+15.10 KB) 🔍
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.27 MB 10.27 MB +0% (+120 B) 👌

@anais-raison anais-raison force-pushed the anais/use-v05-format-refacto branch from 10683ae to 7dd1440 Compare May 20, 2026 14:37
@anais-raison anais-raison force-pushed the anais/use-v05-format-refacto branch from 7dd1440 to b18e13c Compare May 20, 2026 14:41
@anais-raison anais-raison marked this pull request as ready for review May 20, 2026 14:47
@anais-raison anais-raison requested review from a team as code owners May 20, 2026 14:47
@codecov-commenter

codecov-commenter commented May 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.18519% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.76%. Comparing base (b6ea82e) to head (9830a56).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1946      +/-   ##
==========================================
+ Coverage   72.74%   72.76%   +0.02%     
==========================================
  Files         458      458              
  Lines       75790    75818      +28     
==========================================
+ Hits        55136    55172      +36     
+ Misses      20654    20646       -8     
Components Coverage Δ
libdd-crashtracker 65.21% <ø> (+0.04%) ⬆️
libdd-crashtracker-ffi 36.82% <ø> (ø)
libdd-alloc 98.77% <ø> (ø)
libdd-data-pipeline 85.27% <50.00%> (-0.04%) ⬇️
libdd-data-pipeline-ffi 70.51% <ø> (ø)
libdd-common 79.85% <100.00%> (+0.03%) ⬆️
libdd-common-ffi 74.41% <ø> (ø)
libdd-telemetry 73.34% <ø> (ø)
libdd-telemetry-ffi 31.36% <ø> (ø)
libdd-dogstatsd-client 82.64% <ø> (ø)
datadog-ipc 76.17% <ø> (-0.05%) ⬇️
libdd-profiling 81.68% <ø> (-0.02%) ⬇️
libdd-profiling-ffi 64.79% <ø> (ø)
libdd-sampling 97.46% <ø> (ø)
datadog-sidecar 29.19% <ø> (ø)
datdog-sidecar-ffi 10.17% <ø> (ø)
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 88.83% <85.71%> (-0.04%) ⬇️
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.

Comment thread libdd-trace-utils/src/msgpack_encoder/v04/mod.rs Outdated
Comment thread libdd-trace-utils/src/tracer_payload.rs Outdated
Comment thread libdd-data-pipeline/src/trace_exporter/trace_serializer.rs Outdated
Comment thread libdd-trace-utils/src/msgpack_encoder/v04/mod.rs
Comment thread libdd-trace-utils/src/trace_utils.rs Outdated
Comment thread libdd-trace-utils/src/trace_utils.rs
@anais-raison anais-raison requested a review from a team as a code owner May 22, 2026 11:36

Copilot AI 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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI 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.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread libdd-trace-utils/src/msgpack_encoder/v1/mod.rs
Comment thread libdd-trace-utils/src/msgpack_encoder/v04/mod.rs

@yannham yannham 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.

Left a couple doc nits but LGMT 👍

Comment thread libdd-trace-utils/src/msgpack_encoder/v04/mod.rs Outdated
Comment thread libdd-trace-utils/src/msgpack_encoder/v1/mod.rs Outdated
Co-authored-by: Yann Hamdaoui <yann.hamdaoui@gmail.com>
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot merged commit 54afa6f into main May 26, 2026
101 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot deleted the anais/use-v05-format-refacto branch May 26, 2026 14:42
iunanua added a commit that referenced this pull request May 29, 2026
# Release proposal for libdd-sampling and its dependencies

This PR contains version bumps based on public API changes and commits
since last release.

## libdd-common
**Next version:** `4.2.0`
**Semver bump:** `minor`
**Tag:** `libdd-common-v4.2.0`

### Commits

- refactor(trace-utils): replace use_v05_format bool and remove
infallible expect (#1946)
- feat(libdd-common): recognize PCF Garden container IDs (#2025)

## libdd-trace-utils (bumped manually due to breaking in #1946)
**Next version:** ~~`5.1.0`~~ `6.0.0`
**Semver bump:** ~~`minor`~~ `major`
**Tag:** ~~`libdd-trace-utils-v5.1.0`~~ `libdd-trace-utils-v6.0.0`

### Commits

- feat(trace-utils)!: introduce VecMap datastructure (#2022)
- feat: update test agent version (#2038)
- refactor(trace-utils): replace use_v05_format bool and remove
infallible expect (#1946)
The breaking change is the signature of the public function
`libdd_trace_utils::trace_utils::collect_trace_chunks`:
- Before: `pub fn collect_trace_chunks<T: TraceData>(traces: ...,
use_v05_format: bool)` -> ...
- After: `pub fn collect_trace_chunks<T: TraceData>(traces: ..., format:
TraceEncoding)` -> ...


## libdd-sampling
**Next version:** `2.0.0`
**Semver bump:** `major`
**Tag:** `libdd-sampling-v2.0.0`

### :warning: major bump forced due to:

- `libdd-trace-utils`: ^4.0.0 → ^6.0.0

### Commits

- fix(sampling): disable libdd-common default features (#2057)
- feat(trace-utils)!: add from_string to span text (#2011)

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: iunanua <18325288+iunanua@users.noreply.github.com>
Co-authored-by: iunanua <igor.unanua@datadoghq.com>
iunanua added a commit that referenced this pull request Jun 8, 2026
# Release proposal for libdd-data-pipeline and its dependencies

This PR contains version bumps based on public API changes and commits
since last release.

## libdd-trace-utils
**Next version:** `8.0.0`
**Semver bump:** `major`
**Tag:** `libdd-trace-utils-v8.0.0`

### Commits

- refactor(vecmap)!: avoid Clone bound from dedup (#2069)

## libdd-telemetry
**Next version:** `5.0.1`
**Semver bump:** `patch`
**Tag:** `libdd-telemetry-v5.0.1`

### Commits

- fix(libdd-telemetry): serialize Method::Other as "*" per OpenAPI spec
(#1998)

## libdd-trace-obfuscation
**Next version:** `4.0.0`
**Semver bump:** `major`
**Tag:** `libdd-trace-obfuscation-v4.0.0`

### ⚠️ major bump forced due to:

- `libdd-trace-utils`: ^5.0.0 → ^7.0.0

### Commits

- ci: bump msrv to 1.87.0 (#2017)

## libdd-trace-stats
**Next version:** `5.0.0`
**Semver bump:** `major`
**Tag:** `libdd-trace-stats-v5.0.0`

### ⚠️ major bump forced due to:

- `libdd-trace-utils`: ^5.0.0 → ^7.0.0

### Commits

- revert!: add from_string to span text (#2011) (#2073)
- fix(send_with_retry): follow max retries of the strategy (#2047)
- ci: bump msrv to 1.87.0 (#2017)

## libdd-data-pipeline
**Next version:** `6.0.0`
**Semver bump:** `major`
**Tag:** `libdd-data-pipeline-v6.0.0`

### ⚠️ major bump forced due to:

- `libdd-trace-utils`: ^5.0.0 → ^7.0.0

### Commits

- feat(data-pipeline)!: add fork safety hooks and cancellation token for
trace exporter FFI (#2051)
- revert!: add from_string to span text (#2011) (#2073)
- feat(data-pipeline): move the async boundary up (#2064)
- feat(trace-exporter): add fail-closed fallback to v04 (#2037)
- fix(send_with_retry): follow max retries of the strategy (#2047)
- refactor(trace-utils): replace use_v05_format bool and remove
infallible expect (#1946)
- ci: bump msrv to 1.87.0 (#2017)

## libdd-sampling (manually bumped as it wasn't included in the
proposal)
**Next version:** `4.0.0`
**Semver bump:** `major`
**Tag:** `libdd-sampling-v4.0.0`

### ⚠️ major bump forced due to:

- `libdd-trace-utils`: ^7.0.0 → ^8.0.0

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: iunanua <18325288+iunanua@users.noreply.github.com>
Co-authored-by: iunanua <igor.unanua@datadoghq.com>
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.

7 participants