From f116af5f7ac6e4e02173f8e6b42cd42bfdfa42ca Mon Sep 17 00:00:00 2001 From: Andrzej Stencel Date: Thu, 23 May 2024 14:35:59 +0200 Subject: [PATCH] Remove deprecated fields from OTel ResolverSettings The `Providers` and `Converters` fields of `ResolverSettings` struct were deprecated in [v0.99.0](https://github.com/open-telemetry/opentelemetry-collector/releases/tag/v0.99.0) (https://github.com/open-telemetry/opentelemetry-collector/pull/9516/) and removed in [v0.101.0](https://github.com/open-telemetry/opentelemetry-collector/releases/tag/v0.101.0). This refactoring is required before updating to OTel v0.101.0. --- internal/pkg/otel/run.go | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/internal/pkg/otel/run.go b/internal/pkg/otel/run.go index b86bd3f663a..fc7cc5f4b45 100644 --- a/internal/pkg/otel/run.go +++ b/internal/pkg/otel/run.go @@ -53,18 +53,19 @@ func newSettings(version string, configPaths []string) (*otelcol.CollectorSettin Description: buildDescription, Version: version, } - converterSet := confmap.ConverterSettings{} configProviderSettings := otelcol.ConfigProviderSettings{ ResolverSettings: confmap.ResolverSettings{ URIs: configPaths, - Providers: makeMapProvidersMap( - fileprovider.NewWithSettings(confmap.ProviderSettings{}), - envprovider.NewWithSettings(confmap.ProviderSettings{}), - yamlprovider.NewWithSettings(confmap.ProviderSettings{}), - httpprovider.NewWithSettings(confmap.ProviderSettings{}), - httpsprovider.NewWithSettings(confmap.ProviderSettings{}), - ), - Converters: []confmap.Converter{expandconverter.New(converterSet)}, + ProviderFactories: []confmap.ProviderFactory{ + fileprovider.NewFactory(), + envprovider.NewFactory(), + yamlprovider.NewFactory(), + httpprovider.NewFactory(), + httpsprovider.NewFactory(), + }, + ConverterFactories: []confmap.ConverterFactory{ + expandconverter.NewFactory(), + }, }, } provider, err := otelcol.NewConfigProvider(configProviderSettings) @@ -81,11 +82,3 @@ func newSettings(version string, configPaths []string) (*otelcol.CollectorSettin DisableGracefulShutdown: true, }, nil } - -func makeMapProvidersMap(providers ...confmap.Provider) map[string]confmap.Provider { - ret := make(map[string]confmap.Provider, len(providers)) - for _, provider := range providers { - ret[provider.Scheme()] = provider - } - return ret -}