Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for configuring compression levels #11805

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

rnishtala-sumo
Copy link
Contributor

Description

Add the option of configuring compression levels. This is not intended to be a breaking change for the user.

Link to tracking issue

Issue - #10467

Testing

Unit tests were added/changed

@rnishtala-sumo rnishtala-sumo force-pushed the compression-config-option2 branch 3 times, most recently from 7bbcdeb to ad9e1ee Compare December 4, 2024 23:22
Copy link

codecov bot commented Dec 4, 2024

Codecov Report

Attention: Patch coverage is 86.95652% with 9 lines in your changes missing coverage. Please review.

Project coverage is 91.60%. Comparing base (b4ae0ba) to head (73ee65f).

Files with missing lines Patch % Lines
config/confighttp/compressor.go 75.00% 7 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11805      +/-   ##
==========================================
- Coverage   91.62%   91.60%   -0.02%     
==========================================
  Files         447      447              
  Lines       23737    23780      +43     
==========================================
+ Hits        21749    21784      +35     
- Misses       1613     1619       +6     
- Partials      375      377       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rnishtala-sumo rnishtala-sumo force-pushed the compression-config-option2 branch 3 times, most recently from b9aedbf to 853d79f Compare December 5, 2024 18:41
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: 'breaking'
Copy link
Member

Choose a reason for hiding this comment

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

Not breaking anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed this to enhancement.

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
Copy link
Member

Choose a reason for hiding this comment

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

Please add more details here describing a new field

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added some description, PTAL, thanks!

config/configcompression/compressiontype.go Outdated Show resolved Hide resolved
config/configgrpc/go.mod Outdated Show resolved Hide resolved
config/confighttp/compression.go Outdated Show resolved Hide resolved
config/confighttp/compression_test.go Outdated Show resolved Hide resolved
config/confighttp/compression_test.go Outdated Show resolved Hide resolved
@@ -104,16 +119,26 @@ func TestHTTPClientCompression(t *testing.T) {

req, err := http.NewRequest(http.MethodGet, srv.URL, reqBody)
require.NoError(t, err, "failed to create request to test handler")

compressionType := tt.encoding
err = compressionType.UnmarshalText([]byte(tt.encoding))
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need UnmarshalText?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, we don't need this, since we already validate this later

- SpeedFastest: `1`
- SpeedDefault: `3`
- SpeedBetterCompression: `6`
- SpeedBestCompression: `11`
Copy link
Member

Choose a reason for hiding this comment

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

Does it mean that zstd has more levels? I see we don't validate that

Copy link
Contributor Author

@rnishtala-sumo rnishtala-sumo Dec 16, 2024

Choose a reason for hiding this comment

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

zstd doesn't seem to need number validation because it picks the nearest level to whatever number is entered.

// Checks the validity of zlib/gzip/flate compression levels
func isValidLevel(level configcompression.Level) bool {
return level == zlib.DefaultCompression ||
level == configcompression.LevelNone ||
Copy link
Member

Choose a reason for hiding this comment

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

Why not zlib.NoCompression?

config/confighttp/confighttp.go Outdated Show resolved Hide resolved
@rnishtala-sumo
Copy link
Contributor Author

@dmitryax this latest commit has all the changes from the most recent review.

@rnishtala-sumo
Copy link
Contributor Author

@dmitryax please let me know if there are any other changes that you'd like to see!

Copy link
Contributor

github-actions bot commented Jan 3, 2025

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jan 3, 2025
@github-actions github-actions bot removed the Stale label Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants