Skip to content

Commit

Permalink
Updated the Readme with compression_config
Browse files Browse the repository at this point in the history
  • Loading branch information
rnishtala-sumo committed Dec 4, 2024
1 parent 9018dad commit 7bbcdeb
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
25 changes: 25 additions & 0 deletions config/confighttp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,31 @@ README](../configtls/README.md).
- `compression`: Compression type to use among `gzip`, `zstd`, `snappy`, `zlib`, `deflate`, and `lz4`.
- look at the documentation for the server-side of the communication.
- `none` will be treated as uncompressed, and any other inputs will cause an error.
- `compression_config` : Configure advanced compression options
- `level`: Configure compression level for `compression` type
- The following are valid combinations of `compression` and `level`
- `gzip`
- NoCompression: `0`
- BestSpeed: `1`
- BestCompression: `9`
- DefaultCompression: `-1`
- `zlib`
- NoCompression: `0`
- BestSpeed: `1`
- BestCompression: `9`
- DefaultCompression: `-1`
- `deflate`
- NoCompression: `0`
- BestSpeed: `1`
- BestCompression: `9`
- DefaultCompression: `-1`
- `zstd`
- SpeedFastest: `1`
- SpeedDefault: `3`
- SpeedBetterCompression: `6`
- SpeedBestCompression: `11`
- `snappy`
No compression levels supported yet
- [`max_idle_conns`](https://golang.org/pkg/net/http/#Transport)
- [`max_idle_conns_per_host`](https://golang.org/pkg/net/http/#Transport)
- [`max_conns_per_host`](https://golang.org/pkg/net/http/#Transport)
Expand Down
5 changes: 3 additions & 2 deletions config/confighttp/compression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,16 @@ 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 := configcompression.Type(tt.encoding)
compressionType := tt.encoding
err = compressionType.UnmarshalText([]byte(tt.encoding))
require.NoError(t, err)
compression_config := newCompressionConfig(tt.enclevel)
err = compression_config.Validate()
clientSettings := ClientConfig{
Endpoint: srv.URL,
Compression: tt.encoding,
CompressionConfig: newCompressionConfig(tt.enclevel),
}
compressionType.UnmarshalText([]byte(tt.encoding))
if tt.shouldError {
assert.Error(t, err)
message := fmt.Sprintf("unsupported compression type and level %s - %d", tt.encoding, tt.enclevel)
Expand Down
2 changes: 1 addition & 1 deletion exporter/otlpexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/knadh/koanf/maps v0.1.1 // indirect
github.com/knadh/koanf/providers/confmap v0.1.0 // indirect
github.com/knadh/koanf/v2 v2.1.2 // indirect
Expand Down
4 changes: 2 additions & 2 deletions exporter/otlpexporter/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7bbcdeb

Please sign in to comment.