Skip to content

Commit

Permalink
[exporter/sumologicexporter]: Removed deprecated compress encoding in…
Browse files Browse the repository at this point in the history
… sumo exporter (#33604)

**Description**:

Switched to use compression from client config, [compress_encdoing is
deprecated](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/fc363988211d90ee2ae7c75eda6ce90c04bae868/exporter/sumologicexporter/config.go#L31),
so removing from exporter.

Link to tracking Issue:
-
#33138

**Testing**:

Unit test

**Documentation**:

chloggen
  • Loading branch information
chan-tim-sumo authored Jun 26, 2024
1 parent 041812a commit 8f307f5
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 20 deletions.
27 changes: 27 additions & 0 deletions .chloggen/chan-tim_deprecateCompressEncoding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

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

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: sumologicexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: removed compress_encoding

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [33604]

# (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:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
2 changes: 1 addition & 1 deletion exporter/sumologicexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ exporters:
# unique URL generated for your HTTP Source, this is the address to send data to
endpoint: <HTTP_Source_URL>
# Compression encoding format, empty string means no compression, default = gzip
compress_encoding: {gzip, deflate, ""}
compression: {gzip, deflate, zstd, ""}
# max HTTP request body size in bytes before compression (if applied),
# default = 1_048_576 (1MB)
max_request_body_size: <max_request_body_size>
Expand Down
20 changes: 6 additions & 14 deletions exporter/sumologicexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ type Config struct {
// Compression encoding format, either empty string, gzip or deflate (default gzip)
// Empty string means no compression
// NOTE: CompressEncoding is deprecated and will be removed in an upcoming release
CompressEncoding configcompression.Type `mapstructure:"compress_encoding"`
CompressEncoding *configcompression.Type `mapstructure:"compress_encoding"`

// Max HTTP request body size in bytes before compression (if applied).
// By default 1MB is recommended.
MaxRequestBodySize int `mapstructure:"max_request_body_size"`
Expand Down Expand Up @@ -73,17 +74,12 @@ func createDefaultClientConfig() confighttp.ClientConfig {

func (cfg *Config) Validate() error {

if cfg.ClientConfig.Timeout < 1 || cfg.ClientConfig.Timeout > maxTimeout {
return fmt.Errorf("timeout must be between 1 and 55 seconds, got %v", cfg.ClientConfig.Timeout)
if cfg.CompressEncoding != nil {
return errors.New("support for compress_encoding configuration has been removed, in favor of compression")
}

switch cfg.CompressEncoding {
case configcompression.TypeGzip:
case configcompression.TypeDeflate:
case NoCompression:

default:
return fmt.Errorf("invalid compression encoding type: %v", cfg.CompressEncoding)
if cfg.ClientConfig.Timeout < 1 || cfg.ClientConfig.Timeout > maxTimeout {
return fmt.Errorf("timeout must be between 1 and 55 seconds, got %v", cfg.ClientConfig.Timeout)
}

switch cfg.ClientConfig.Compression {
Expand All @@ -96,10 +92,6 @@ func (cfg *Config) Validate() error {
return fmt.Errorf("invalid compression encoding type: %v", cfg.ClientConfig.Compression)
}

if cfg.CompressEncoding != NoCompression && cfg.ClientConfig.Compression != DefaultCompressEncoding {
return fmt.Errorf("compress_encoding is deprecated and should not be used when compression is set to a non-default value")
}

switch cfg.LogFormat {
case OTLPLogFormat:
case JSONFormat:
Expand Down
4 changes: 0 additions & 4 deletions exporter/sumologicexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,6 @@ func (se *sumologicexporter) configure(ctx context.Context) error {
foundSumoExt bool
)

if se.config.CompressEncoding != NoCompression {
se.config.ClientConfig.Compression = se.config.CompressEncoding
}

httpSettings := se.config.ClientConfig

for _, e := range se.host.GetExtensions() {
Expand Down
2 changes: 1 addition & 1 deletion exporter/sumologicexporter/sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func prepareSenderTest(t *testing.T, compression configcompression.Type, cb []fu
case configcompression.TypeDeflate:
cfg.ClientConfig.Compression = configcompression.TypeDeflate
default:
cfg.CompressEncoding = configcompression.TypeGzip
cfg.ClientConfig.Compression = configcompression.TypeGzip
}
cfg.ClientConfig.Auth = nil
httpSettings := cfg.ClientConfig
Expand Down

0 comments on commit 8f307f5

Please sign in to comment.