fix(traces): update payload size after dropping traces#1091
Open
fix(traces): update payload size after dropping traces#1091
Conversation
…iority filtering After filtering sampled-out TraceChunks from the payload, recompute body_size using prost::Message::encoded_len() on the remaining TracerPayloads instead of passing through the original (unfiltered) request body size. This ensures the TraceAggregator's 3.2 MB batch limit is evaluated against only the data that will actually be sent to the backend. Since libdd-trace-protobuf uses prost 0.14 while bottlecap depends on prost 0.13, add prost014 as an aliased direct dependency so the prost 0.14 Message trait is accessible for TracerPayload. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… tonic-types Replaces the prost014 alias workaround with a straightforward prost 0.14 upgrade. opentelemetry-proto (0.30→0.31) and tonic-types (0.13→0.14) both moved to prost 0.14, so all three can be bumped together, eliminating the dual-version dependency. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
This PR
After dropping sampled-out traces, recompute
body_size. This ensures theTraceAggregator's 3.2 MB batch limit is evaluated against only the data that will actually be sent to the backend.Upgrades the version of some external crates because those are the versions used in libdatadog.
Testing
Note
The recomputed size uses the protobuf encoded payload size, different from the original size, computed from: (from Claude)
The new approach be more accurate because it's computed at a later point for the size of protobuf data, which is what's finally sent to Datadog.
By the way, the size doesn't need to be accurate. An approximate size is good enough. See:
https://github.com/DataDog/libdatadog/blob/3f3efefb2ff45d7a5491b770480396d001b87631/libdd-trace-utils/src/send_data/mod.rs#L148
Also here are some sample logs (logging node not included in the PR) showing the different sizes computed in different ways: