Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] [receiver/apache] Use confighttp.NewDefaultClientConfig instead of manually creating struct #35576

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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