From 6005ae8c85b77a00adfe0e6e5579ddec3fbe3ffb Mon Sep 17 00:00:00 2001 From: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> Date: Fri, 31 May 2024 12:15:12 -0600 Subject: [PATCH] [chore] Remove use of deprecated ConfigProvider (#33323) --- .../integrationtest/integration_test.go | 12 ++++-------- .../internal/staleness_end_to_end_test.go | 12 ++++-------- testbed/testbed/in_process_collector.go | 16 +++++----------- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/exporter/datadogexporter/integrationtest/integration_test.go b/exporter/datadogexporter/integrationtest/integration_test.go index 6e8494ee1af9..7e7fce4b610c 100644 --- a/exporter/datadogexporter/integrationtest/integration_test.go +++ b/exporter/datadogexporter/integrationtest/integration_test.go @@ -271,18 +271,14 @@ func getIntegrationTestCollector(t *testing.T, cfgStr string, url string, factor _, err = otelcoltest.LoadConfigAndValidate(confFile.Name(), factories) require.NoError(t, err, "All yaml config must be valid.") - configProvider, err := otelcol.NewConfigProvider( - otelcol.ConfigProviderSettings{ + appSettings := otelcol.CollectorSettings{ + Factories: func() (otelcol.Factories, error) { return factories, nil }, + ConfigProviderSettings: otelcol.ConfigProviderSettings{ ResolverSettings: confmap.ResolverSettings{ URIs: []string{confFile.Name()}, ProviderFactories: []confmap.ProviderFactory{fileprovider.NewFactory()}, }, - }) - require.NoError(t, err) - - appSettings := otelcol.CollectorSettings{ - Factories: func() (otelcol.Factories, error) { return factories, nil }, - ConfigProvider: configProvider, + }, BuildInfo: component.BuildInfo{ Command: "otelcol", Description: "OpenTelemetry Collector", diff --git a/receiver/prometheusreceiver/internal/staleness_end_to_end_test.go b/receiver/prometheusreceiver/internal/staleness_end_to_end_test.go index 5e170280ad45..83aaa386e07c 100644 --- a/receiver/prometheusreceiver/internal/staleness_end_to_end_test.go +++ b/receiver/prometheusreceiver/internal/staleness_end_to_end_test.go @@ -146,18 +146,14 @@ service: Processors: processors, } - configProvider, err := otelcol.NewConfigProvider( - otelcol.ConfigProviderSettings{ + appSettings := otelcol.CollectorSettings{ + Factories: func() (otelcol.Factories, error) { return factories, nil }, + ConfigProviderSettings: otelcol.ConfigProviderSettings{ ResolverSettings: confmap.ResolverSettings{ URIs: []string{confFile.Name()}, ProviderFactories: []confmap.ProviderFactory{fileprovider.NewFactory()}, }, - }) - require.NoError(t, err) - - appSettings := otelcol.CollectorSettings{ - Factories: func() (otelcol.Factories, error) { return factories, nil }, - ConfigProvider: configProvider, + }, BuildInfo: component.BuildInfo{ Command: "otelcol", Description: "OpenTelemetry Collector", diff --git a/testbed/testbed/in_process_collector.go b/testbed/testbed/in_process_collector.go index 766417466dd2..77dcd781a625 100644 --- a/testbed/testbed/in_process_collector.go +++ b/testbed/testbed/in_process_collector.go @@ -57,21 +57,15 @@ func (ipp *inProcessCollector) Start(_ StartParams) error { } ipp.configFile = confFile.Name() - configProvider, err := otelcol.NewConfigProvider( - otelcol.ConfigProviderSettings{ + settings := otelcol.CollectorSettings{ + BuildInfo: component.NewDefaultBuildInfo(), + Factories: func() (otelcol.Factories, error) { return ipp.factories, nil }, + ConfigProviderSettings: otelcol.ConfigProviderSettings{ ResolverSettings: confmap.ResolverSettings{ URIs: []string{ipp.configFile}, ProviderFactories: []confmap.ProviderFactory{fileprovider.NewFactory()}, }, - }) - if err != nil { - return err - } - - settings := otelcol.CollectorSettings{ - BuildInfo: component.NewDefaultBuildInfo(), - Factories: func() (otelcol.Factories, error) { return ipp.factories, nil }, - ConfigProvider: configProvider, + }, SkipSettingGRPCLogger: true, }