diff --git a/exporter/splunkhecexporter/config_test.go b/exporter/splunkhecexporter/config_test.go index 8af89fad6014..f4fd6f38a62d 100644 --- a/exporter/splunkhecexporter/config_test.go +++ b/exporter/splunkhecexporter/config_test.go @@ -4,6 +4,7 @@ package splunkhecexporter import ( + "net/http" "path/filepath" "testing" "time" @@ -13,6 +14,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/confighttp" + "go.opentelemetry.io/collector/config/configopaque" "go.opentelemetry.io/collector/config/configretry" "go.opentelemetry.io/collector/config/configtls" "go.opentelemetry.io/collector/confmap/confmaptest" @@ -24,6 +26,8 @@ import ( ) func TestLoadConfig(t *testing.T) { + defaultMaxConnsPerHost := http.DefaultTransport.(*http.Transport).MaxConnsPerHost + t.Parallel() cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config.yaml")) @@ -77,6 +81,8 @@ func TestLoadConfig(t *testing.T) { IdleConnTimeout: &idleConnTimeout, HTTP2ReadIdleTimeout: 10 * time.Second, HTTP2PingTimeout: 10 * time.Second, + Headers: map[string]configopaque.String{}, + MaxConnsPerHost: &defaultMaxConnsPerHost, }, BackOffConfig: configretry.BackOffConfig{ Enabled: true, diff --git a/exporter/splunkhecexporter/factory.go b/exporter/splunkhecexporter/factory.go index 51ed1670f07f..e2e7b9c77ed9 100644 --- a/exporter/splunkhecexporter/factory.go +++ b/exporter/splunkhecexporter/factory.go @@ -64,17 +64,19 @@ func createDefaultConfig() component.Config { defaultMaxConns := defaultMaxIdleCons defaultIdleConnTimeout := defaultIdleConnTimeout + + clientConfig := confighttp.NewDefaultClientConfig() + clientConfig.Timeout = defaultHTTPTimeout + clientConfig.IdleConnTimeout = &defaultIdleConnTimeout + clientConfig.MaxIdleConnsPerHost = &defaultMaxConns + clientConfig.MaxIdleConns = &defaultMaxConns + clientConfig.HTTP2ReadIdleTimeout = defaultHTTP2ReadIdleTimeout + clientConfig.HTTP2PingTimeout = defaultHTTP2PingTimeout + return &Config{ - LogDataEnabled: true, - ProfilingDataEnabled: true, - ClientConfig: confighttp.ClientConfig{ - Timeout: defaultHTTPTimeout, - IdleConnTimeout: &defaultIdleConnTimeout, - MaxIdleConnsPerHost: &defaultMaxConns, - MaxIdleConns: &defaultMaxConns, - HTTP2ReadIdleTimeout: defaultHTTP2ReadIdleTimeout, - HTTP2PingTimeout: defaultHTTP2PingTimeout, - }, + LogDataEnabled: true, + ProfilingDataEnabled: true, + ClientConfig: clientConfig, SplunkAppName: defaultSplunkAppName, BackOffConfig: configretry.NewDefaultBackOffConfig(), QueueSettings: exporterhelper.NewDefaultQueueConfig(),