fix(otlp): use body.len() for body_size and fix empty-traces check#1093
Draft
fix(otlp): use body.len() for body_size and fix empty-traces check#1093
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>
Contributor
Author
|
@duncanista In your PR #654 there's a commit use size_of_val for payload, instead of .encoded_len(). Do you remember why? |
size_of_val(&traces) returned the 24-byte stack size of the Vec regardless of content, so body_size was always a meaningless constant and the empty-trace guard never fired. Use body.len() for the actual OTLP wire byte count and traces.is_empty() for the empty-trace guard. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
c651cfe to
4fa9dca
Compare
Contributor
|
@lym953 I remember it was because it was "more correct", I think after using prost, the method for len wasn't available on the message itself, it would crash |
Contributor
Author
|
@duncanista Thanks. From my test, I didn't see any problem using |
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.
Summary
size_of_val(&traces)returned the 24-byte stack size of theVecregardless of content, sobody_sizewas always a meaningless constant and the empty-trace guard (if body_size == 0) never firedbody.len()(raw OTLP wire bytes) forbody_sizeandtraces.is_empty()for the empty-trace guardTest plan
test_v1_traces_empty_request_returns_error: verifies that an OTLP request with no spans returns 500 (previously the guard never fired)test_v1_traces_body_size_equals_request_body_len: verifies thatbody_sizepassed toprocess_tracesequalsbody.len()🤖 Generated with Claude Code