Skip to content

stats/opentelemetry: dynamically calculate compressed message size in tests - #9346

Merged
eshitachandwani merged 2 commits into
grpc:masterfrom
eshitachandwani:fixcodecov
Aug 21, 2026
Merged

eshitachandwani merged 2 commits into
grpc:masterfrom
eshitachandwani:fixcodecov

Conversation

@eshitachandwani

Copy link
Copy Markdown
Member

Tests in stats/opentelemetry and stats/opentelemetry/csm asserted a hardcoded compressed message size of 57 bytes for a 10,000-byte zero payload with gzip compression.
In Go 1.27, standard library compress/gzip compression improvements changed the output size of this payload from 57 bytes to 54 bytes, causing metric and trace size assertions to fail when executed under newer Go toolchains.

Added GzipCompressedMessageSize helper in to compute the expected compressed byte length dynamically via compress/gzip. Updated metric and trace assertions to use the same.

RELEASE NOTES: None

@eshitachandwani eshitachandwani added this to the 1.85 Release milestone Aug 21, 2026
@codecov

codecov Bot commented Aug 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.40%. Comparing base (965a6bf) to head (5157154).

Files with missing lines Patch % Lines
...tats/opentelemetry/internal/testutils/testutils.go 72.72% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9346      +/-   ##
==========================================
+ Coverage   83.15%   87.40%   +4.25%     
==========================================
  Files         424      424              
  Lines       35312    30284    -5028     
==========================================
- Hits        29362    26470    -2892     
+ Misses       4436     3814     -622     
+ Partials     1514        0    -1514     
Files with missing lines Coverage Δ
...tats/opentelemetry/internal/testutils/testutils.go 97.03% <72.72%> (+1.65%) ⬆️

... and 423 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mbissa

mbissa commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

/gemini review

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request replaces hardcoded gzip-compressed message sizes (previously set to 57 bytes) in CSM and end-to-end tests with dynamically calculated sizes. A new helper function 'GzipCompressedMessageSize' is introduced in the internal 'testutils' package to marshal and gzip-compress protobuf messages to determine their exact size dynamically. There are no review comments, and we have no feedback to provide.

Comment thread coverage.out Outdated

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.

Please remove this.

@mbissa

mbissa commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

LGTM, modulo tests passing.

@mbissa mbissa removed their assignment Aug 21, 2026
@eshitachandwani
eshitachandwani merged commit ef79129 into grpc:master Aug 21, 2026
19 checks passed
eshitachandwani added a commit that referenced this pull request Aug 25, 2026
Original PR : #9346 

RELEASE NOTES: None
eshitachandwani added a commit that referenced this pull request Aug 25, 2026
Original PR : #9346

Also updates the x/net dependency to ensure compatibility with go1.27
because of the issue reported here :
golang/go#80482

RELEASE NOTES: None
eshitachandwani added a commit that referenced this pull request Aug 25, 2026
Original PR : #9346

RELEASE NOTES: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants