From 7bbcdeb67eb0e2a973248d459885559981b7a224 Mon Sep 17 00:00:00 2001 From: Raj Nishtala Date: Wed, 4 Dec 2024 18:14:11 -0500 Subject: [PATCH] Updated the Readme with compression_config --- config/confighttp/README.md | 25 +++++++++++++++++++++++++ config/confighttp/compression_test.go | 5 +++-- exporter/otlpexporter/go.mod | 2 +- exporter/otlpexporter/go.sum | 4 ++-- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/config/confighttp/README.md b/config/confighttp/README.md index 160041d8a5c..f866f927672 100644 --- a/config/confighttp/README.md +++ b/config/confighttp/README.md @@ -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) diff --git a/config/confighttp/compression_test.go b/config/confighttp/compression_test.go index 05f8ffe411b..5b4314d7239 100644 --- a/config/confighttp/compression_test.go +++ b/config/confighttp/compression_test.go @@ -119,7 +119,9 @@ 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{ @@ -127,7 +129,6 @@ func TestHTTPClientCompression(t *testing.T) { 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) diff --git a/exporter/otlpexporter/go.mod b/exporter/otlpexporter/go.mod index 1a759cf5f28..888d1970382 100644 --- a/exporter/otlpexporter/go.mod +++ b/exporter/otlpexporter/go.mod @@ -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 diff --git a/exporter/otlpexporter/go.sum b/exporter/otlpexporter/go.sum index f25ea25d5a9..5359504ba4d 100644 --- a/exporter/otlpexporter/go.sum +++ b/exporter/otlpexporter/go.sum @@ -27,8 +27,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= -github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= +github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= github.com/knadh/koanf/maps v0.1.1 h1:G5TjmUh2D7G2YWf5SQQqSiHRJEjaicvU0KpypqB3NIs= github.com/knadh/koanf/maps v0.1.1/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI= github.com/knadh/koanf/providers/confmap v0.1.0 h1:gOkxhHkemwG4LezxxN8DMOFopOPghxRVp7JbIvdvqzU=