Skip to content

Commit

Permalink
[chore] [receiver/apache] Use confighttp.NewDefaultClientConfig inste…
Browse files Browse the repository at this point in the history
…ad of manually creating struct (open-telemetry#35576)

**Description:**
This PR makes usage of `NewDefaultClientConfig` instead of manually
creating the confighttp.ClientConfig struct.

**Link to tracking Issue:** open-telemetry#35457
  • Loading branch information
mackjmr authored and sbylica-splunk committed Dec 17, 2024
1 parent ee4934d commit e02fbc3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions receiver/apachereceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ func NewFactory() receiver.Factory {
func createDefaultConfig() component.Config {
cfg := scraperhelper.NewDefaultControllerConfig()
cfg.CollectionInterval = 10 * time.Second
clientConfig := confighttp.NewDefaultClientConfig()
clientConfig.Endpoint = defaultEndpoint
clientConfig.Timeout = 10 * time.Second

return &Config{
ControllerConfig: cfg,
ClientConfig: confighttp.ClientConfig{
Endpoint: defaultEndpoint,
Timeout: 10 * time.Second,
},
ControllerConfig: cfg,
ClientConfig: clientConfig,
MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(),
}
}
Expand Down
16 changes: 8 additions & 8 deletions receiver/apachereceiver/scraper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ func TestScraper(t *testing.T) {
}

func TestScraperFailedStart(t *testing.T) {
sc := newApacheScraper(receivertest.NewNopSettings(), &Config{
ClientConfig: confighttp.ClientConfig{
Endpoint: "localhost:8080",
TLSSetting: configtls.ClientConfig{
Config: configtls.Config{
CAFile: "/non/existent",
},
},
clientConfig := confighttp.NewDefaultClientConfig()
clientConfig.Endpoint = "localhost:8080"
clientConfig.TLSSetting = configtls.ClientConfig{
Config: configtls.Config{
CAFile: "/non/existent",
},
}
sc := newApacheScraper(receivertest.NewNopSettings(), &Config{
ClientConfig: clientConfig,
},
"localhost",
"8080")
Expand Down

0 comments on commit e02fbc3

Please sign in to comment.