Skip to content

Commit c31d69d

Browse files
fix(compression): Changes that follow core breaking changes to the confighttp API
1 parent cf25636 commit c31d69d

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

exporter/splunkhecexporter/client.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414

1515
"github.com/goccy/go-json"
1616
"go.opentelemetry.io/collector/component"
17+
"go.opentelemetry.io/collector/config/configcompression"
1718
"go.opentelemetry.io/collector/consumer/consumererror"
1819
"go.opentelemetry.io/collector/exporter"
1920
"go.opentelemetry.io/collector/pdata/plog"
@@ -658,7 +659,7 @@ func checkHecHealth(ctx context.Context, client *http.Client, healthCheckURL *ur
658659

659660
func buildHTTPClient(ctx context.Context, config *Config, host component.Host, telemetrySettings component.TelemetrySettings) (*http.Client, error) {
660661
// we handle compression explicitly.
661-
config.ClientConfig.Compression = ""
662+
config.ClientConfig.Compression = configcompression.TypeWithLevel{Type: "", Level: 0}
662663
return config.ToClient(ctx, host, telemetrySettings)
663664
}
664665

pkg/datadog/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func validateClientConfig(cfg confighttp.ClientConfig) error {
144144
if cfg.Endpoint != "" {
145145
unsupported = append(unsupported, "endpoint")
146146
}
147-
if cfg.Compression != "" {
147+
if cfg.Compression.Type != "" {
148148
unsupported = append(unsupported, "compression")
149149
}
150150
if len(cfg.Headers) > 0 {

pkg/datadog/config/config_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"go.opentelemetry.io/collector/component"
1414
"go.opentelemetry.io/collector/component/componenttest"
1515
"go.opentelemetry.io/collector/config/configauth"
16+
"go.opentelemetry.io/collector/config/configcompression"
1617
"go.opentelemetry.io/collector/config/confighttp"
1718
"go.opentelemetry.io/collector/config/confignet"
1819
"go.opentelemetry.io/collector/config/configopaque"
@@ -163,7 +164,7 @@ func TestValidate(t *testing.T) {
163164
API: APIConfig{Key: "notnull"},
164165
ClientConfig: confighttp.ClientConfig{
165166
Endpoint: "endpoint",
166-
Compression: "gzip",
167+
Compression: configcompression.TypeWithLevel{Type: configcompression.TypeGzip, Level: -1},
167168
Auth: &auth,
168169
Headers: map[string]configopaque.String{"key": "val"},
169170
HTTP2ReadIdleTimeout: 250,

testbed/testbed/senders.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (dsb *DataSenderBase) Flush() {
7878

7979
type otlpHTTPDataSender struct {
8080
DataSenderBase
81-
compression configcompression.Type
81+
compression configcompression.TypeWithLevel
8282
}
8383

8484
func (ods *otlpHTTPDataSender) fillConfig(cfg *otlphttpexporter.Config) *otlphttpexporter.Config {

0 commit comments

Comments
 (0)