From fc2b73183c20aeee93febb2067a4e282afc8d459 Mon Sep 17 00:00:00 2001 From: Mackenzie <63265430+mackjmr@users.noreply.github.com> Date: Fri, 4 Oct 2024 20:03:03 +0200 Subject: [PATCH] [chore] [receiver/github] Use confighttp.NewDefaultClientConfig instead of manually creating struct (#35616) **Description:** This PR makes usage of `NewDefaultClientConfig` instead of manually creating the confighttp.ClientConfig struct. **Link to tracking Issue:** #35457 --- .../internal/scraper/githubscraper/config_test.go | 7 ++++--- .../internal/scraper/githubscraper/factory.go | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/receiver/githubreceiver/internal/scraper/githubscraper/config_test.go b/receiver/githubreceiver/internal/scraper/githubscraper/config_test.go index 268d2f347808..9df8b203709a 100644 --- a/receiver/githubreceiver/internal/scraper/githubscraper/config_test.go +++ b/receiver/githubreceiver/internal/scraper/githubscraper/config_test.go @@ -19,11 +19,12 @@ func TestConfig(t *testing.T) { factory := Factory{} defaultConfig := factory.CreateDefaultConfig() + clientConfig := confighttp.NewDefaultClientConfig() + clientConfig.Timeout = 15 * time.Second + expectedConfig := &Config{ MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(), - ClientConfig: confighttp.ClientConfig{ - Timeout: 15 * time.Second, - }, + ClientConfig: clientConfig, } assert.Equal(t, expectedConfig, defaultConfig) diff --git a/receiver/githubreceiver/internal/scraper/githubscraper/factory.go b/receiver/githubreceiver/internal/scraper/githubscraper/factory.go index 1a66e72b410c..073c7077adbb 100644 --- a/receiver/githubreceiver/internal/scraper/githubscraper/factory.go +++ b/receiver/githubreceiver/internal/scraper/githubscraper/factory.go @@ -24,11 +24,11 @@ const ( type Factory struct{} func (f *Factory) CreateDefaultConfig() internal.Config { + clientConfig := confighttp.NewDefaultClientConfig() + clientConfig.Timeout = defaultHTTPTimeout return &Config{ MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(), - ClientConfig: confighttp.ClientConfig{ - Timeout: defaultHTTPTimeout, - }, + ClientConfig: clientConfig, } }