From 3e072d2010b9e7c0ce7611b0f15f4eba36bfd220 Mon Sep 17 00:00:00 2001 From: Andrzej Stencel Date: Tue, 12 Mar 2024 23:07:38 +0100 Subject: [PATCH] [chore] refactor(sumologicexporter): use `confighttp.NewDefaultClientConfig` (#31510) Use `confighttp.NewDefaultClientConfig` instead of `confighttp.ClientConfig{...}`. **Link to tracking Issue:** https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/6641 **Testing:** Unit tests --- exporter/sumologicexporter/config.go | 6 +++--- exporter/sumologicexporter/factory_test.go | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/exporter/sumologicexporter/config.go b/exporter/sumologicexporter/config.go index 568400ef74e7..16382c6942c7 100644 --- a/exporter/sumologicexporter/config.go +++ b/exporter/sumologicexporter/config.go @@ -62,9 +62,9 @@ type Config struct { // createDefaultClientConfig returns default http client settings func createDefaultClientConfig() confighttp.ClientConfig { - return confighttp.ClientConfig{ - Timeout: defaultTimeout, - } + config := confighttp.NewDefaultClientConfig() + config.Timeout = defaultTimeout + return config } // LogFormatType represents log_format diff --git a/exporter/sumologicexporter/factory_test.go b/exporter/sumologicexporter/factory_test.go index 906cd7d415e3..c37ad2e8ebb3 100644 --- a/exporter/sumologicexporter/factory_test.go +++ b/exporter/sumologicexporter/factory_test.go @@ -40,7 +40,9 @@ func TestCreateDefaultConfig(t *testing.T) { GraphiteTemplate: "%{_metric_}", ClientConfig: confighttp.ClientConfig{ - Timeout: 5 * time.Second, + IdleConnTimeout: confighttp.NewDefaultClientConfig().IdleConnTimeout, + MaxIdleConns: confighttp.NewDefaultClientConfig().MaxIdleConns, + Timeout: 5 * time.Second, }, BackOffConfig: configretry.NewDefaultBackOffConfig(), QueueSettings: qs,