From 27aa54b740557e5c471107767a5f0232cf07d172 Mon Sep 17 00:00:00 2001 From: Christos Markou Date: Wed, 9 Oct 2024 16:35:16 +0300 Subject: [PATCH] [receiver/nginx] Use NewDefaultClientConfig instead of manually creating struct (#35452) **Description:** Similar to https://github.com/open-telemetry/opentelemetry-collector/pull/11273. This PR makes usage of the `NewDefaultClientConfig` instead of manually creating the `confighttp.ClientConfig` struct as part of https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35457. **Link to tracking Issue:** https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35457 **Testing:** **Documentation:** --------- Signed-off-by: ChrsMark --- receiver/nginxreceiver/factory.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/receiver/nginxreceiver/factory.go b/receiver/nginxreceiver/factory.go index d04e07ea848c..feb633b7ca38 100644 --- a/receiver/nginxreceiver/factory.go +++ b/receiver/nginxreceiver/factory.go @@ -28,12 +28,13 @@ func createDefaultConfig() component.Config { cfg := scraperhelper.NewDefaultControllerConfig() cfg.CollectionInterval = 10 * time.Second + clientConfig := confighttp.NewDefaultClientConfig() + clientConfig.Endpoint = "http://localhost:80/status" + clientConfig.Timeout = 10 * time.Second + return &Config{ - ControllerConfig: cfg, - ClientConfig: confighttp.ClientConfig{ - Endpoint: "http://localhost:80/status", - Timeout: 10 * time.Second, - }, + ControllerConfig: cfg, + ClientConfig: clientConfig, MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(), } }