-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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(compression): Add the option of configuring compression levels #11084
base: main
Are you sure you want to change the base?
feat(compression): Add the option of configuring compression levels #11084
Conversation
0500415
to
b13f7fc
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11084 +/- ##
==========================================
- Coverage 91.43% 91.33% -0.10%
==========================================
Files 447 447
Lines 23745 23783 +38
==========================================
+ Hits 21712 21723 +11
- Misses 1657 1682 +25
- Partials 376 378 +2 ☔ View full report in Codecov by Sentry. |
2ff904d
to
e39d5e7
Compare
2165697
to
f478e7d
Compare
f478e7d
to
83cf4e5
Compare
83cf4e5
to
e58acbc
Compare
"strings" | ||
|
||
"github.com/klauspost/compress/zlib" | ||
) | ||
|
||
// Type represents a compression method | ||
type Type string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can reuse this type and keep the level encoded in the string. API users may rely on configcompression.Type == configcompression.TypeGzip
which won't work anymore...
I think we need new additional types like these
type Config struct {
Type Type
Level Level
}
type Level int
Config
may be also called TypeWithLevel
.
Given that this module is 1.x, it should be okay to add. However, we would need to make a breaking change to the Co API (not an end-user breaking change) in config HTTP by changing the confighttp.ClientConfig.Compression
field from compressionconfig.Type
to compressionconfig.Config
, which should be okay given that the confighttp module is still 0.x.
Then we can have all validation in Config.UnmarshalText
and assume that Config is always valid
cc @open-telemetry/collector-approvers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confighttp.ClientConfig.Compression field from compressionconfig.Type to compressionconfig.Config
won't this be a breaking change for the user as well?, i.e with the above suggested change we would need two fields to specify compression like below
compression:
type: "gzip"
level: 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmitryax I've made changes based on the above comment. Please let me know if this is what you had in mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like the tests are failing because of errors like below, since this is now a breaking change
Error: config/config.go:147:24: invalid operation: cfg.Compression != "" (mismatched types configcompression.TypeWithLevel and untyped string)
There are tests in multiple contrib components that are failing because they assume the Compression
is a string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
won't this be a breaking change for the user as well?,
No, we should keep the string encoding <type>/<level>
where the /<level>
part is optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JFYI, I tested that with the above change both of the following configuration are valid
compression struct
exporters:
otlphttp:
endpoint: otelcol:4317
compression:
type: gzip
level: 1
compression string
exporters:
otlphttp:
endpoint: otelcol:4317
compression: gzip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @rnishtala-sumo. To be explicit, I (obviously) think this approach looks good :)
I suppose we'll need to wait for a couple more opinions from approvers to make a final decision
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmitryax @andrzej-stencel do you think we could proceed with @axw's approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: We discussed this during the Collector SIG call on Dec 4. Most of the Collector leads present there (@mx-psi and @jpkrohling) favored introducing another field (compression_params
) to avoid breaking the existing user interface even in a backward compatible way. @rnishtala-sumo is going to submit another PR to implement that approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the new PR with option2 - #11805
e58acbc
to
0b2b372
Compare
0b2b372
to
9fe4614
Compare
60c6f00
to
800a4c2
Compare
800a4c2
to
18d5c7b
Compare
bfe8fb4
to
9ed1c64
Compare
bc6ea67
to
62be46f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this approach. It's additive and doesn't break stable components.
0c53ee2
to
6bcb03a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nits
fbf2ee8
to
518d136
Compare
ac54499
to
976f44c
Compare
…el for compression
…y integer value between BestSpeed and BestCompression inclusive
…compatibility (for string)
976f44c
to
78d83fd
Compare
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
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
Documentation
https://github.com/rnishtala-sumo/opentelemetry-collector/blob/configure-compression-levels/config/confighttp/README.md#client-configuration