diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cc9525c5a2..d9b8155fc76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### 🛑 Breaking changes 🛑 +- Remove non pdata deprecated funcs/structs (#5220) + ### 🚩 Deprecations 🚩 ### 💡 Enhancements 💡 diff --git a/config/configmapprovider/deprecated.go b/config/configmapprovider/deprecated.go deleted file mode 100644 index 111902a25fe..00000000000 --- a/config/configmapprovider/deprecated.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package configmapprovider // import "go.opentelemetry.io/collector/config/configmapprovider" - -import ( - "go.opentelemetry.io/collector/config/mapconverter/expandmapconverter" - "go.opentelemetry.io/collector/config/mapconverter/overwritepropertiesmapconverter" -) - -// Deprecated: [v0.49.0] use expandmapconverter.New. -var NewExpandConverter = expandmapconverter.New - -// Deprecated: [v0.49.0] use overwritepropertiesmapconverter.New. -var NewOverwritePropertiesConverter = overwritepropertiesmapconverter.New diff --git a/service/collector_windows.go b/service/collector_windows.go index 1231bd72a92..09acce845a7 100644 --- a/service/collector_windows.go +++ b/service/collector_windows.go @@ -34,24 +34,18 @@ import ( "go.opentelemetry.io/collector/service/featuregate" ) -// Deprecated: [v0.48.0] will be made private soon. -type WindowsService struct { +type windowsService struct { settings CollectorSettings col *Collector } -// Deprecated: [v0.48.0] use NewSvcHandler. -func NewWindowsService(set CollectorSettings) *WindowsService { - return &WindowsService{settings: set} -} - // NewSvcHandler constructs a new svc.Handler using the given CollectorSettings. func NewSvcHandler(set CollectorSettings) svc.Handler { - return &WindowsService{settings: set} + return &windowsService{settings: set} } // Execute implements https://godoc.org/golang.org/x/sys/windows/svc#Handler -func (s *WindowsService) Execute(args []string, requests <-chan svc.ChangeRequest, changes chan<- svc.Status) (ssec bool, errno uint32) { +func (s *windowsService) Execute(args []string, requests <-chan svc.ChangeRequest, changes chan<- svc.Status) (ssec bool, errno uint32) { // The first argument supplied to service.Execute is the service name. If this is // not provided for some reason, raise a relevant error to the system event log if len(args) == 0 { @@ -94,7 +88,7 @@ func (s *WindowsService) Execute(args []string, requests <-chan svc.ChangeReques return false, 0 } -func (s *WindowsService) start(elog *eventlog.Log, colErrorChannel chan error) error { +func (s *windowsService) start(elog *eventlog.Log, colErrorChannel chan error) error { // Parse all the flags manually. if err := flags().Parse(os.Args[1:]); err != nil { return err @@ -128,7 +122,7 @@ func (s *WindowsService) start(elog *eventlog.Log, colErrorChannel chan error) e return <-colErrorChannel } -func (s *WindowsService) stop(colErrorChannel chan error) error { +func (s *windowsService) stop(colErrorChannel chan error) error { // simulate a SIGTERM signal to terminate the collector server s.col.signalsChannel <- syscall.SIGTERM // return the response of col.Start diff --git a/service/config_provider.go b/service/config_provider.go index 52123a4ee4e..bbdb0d5db43 100644 --- a/service/config_provider.go +++ b/service/config_provider.go @@ -28,7 +28,6 @@ import ( "go.opentelemetry.io/collector/config/configunmarshaler" "go.opentelemetry.io/collector/config/experimental/configsource" "go.opentelemetry.io/collector/config/mapconverter/expandmapconverter" - "go.opentelemetry.io/collector/config/mapconverter/overwritepropertiesmapconverter" "go.opentelemetry.io/collector/config/mapprovider/envmapprovider" "go.opentelemetry.io/collector/config/mapprovider/filemapprovider" "go.opentelemetry.io/collector/config/mapprovider/yamlmapprovider" @@ -106,24 +105,6 @@ func newDefaultConfigProviderSettings(locations []string) ConfigProviderSettings } } -// Deprecated: [v0.49.0] use NewConfigProvider instead. -func MustNewConfigProvider( - locations []string, - configMapProviders map[string]config.MapProvider, - configMapConverters []config.MapConverterFunc, - configUnmarshaler configunmarshaler.ConfigUnmarshaler) ConfigProvider { - cfgProvider, err := NewConfigProvider(ConfigProviderSettings{ - Locations: locations, - MapProviders: configMapProviders, - MapConverters: configMapConverters, - Unmarshaler: configUnmarshaler, - }) - if err != nil { - panic(err) - } - return cfgProvider -} - // NewConfigProvider returns a new ConfigProvider that provides the configuration: // * Retrieve the config.Map by merging all retrieved maps from the given `locations` in order. // * Then applies all the config.MapConverterFunc in the given order. @@ -156,17 +137,6 @@ func NewConfigProvider(set ConfigProviderSettings) (ConfigProvider, error) { }, nil } -// Deprecated: [v0.49.0] use NewConfigProvider instead. -func MustNewDefaultConfigProvider(locations []string, properties []string) ConfigProvider { - set := newDefaultConfigProviderSettings(locations) - set.MapConverters = append([]config.MapConverterFunc{overwritepropertiesmapconverter.New(properties)}, set.MapConverters...) - cfgProvider, err := NewConfigProvider(set) - if err != nil { - panic(err) - } - return cfgProvider -} - func (cm *configProvider) Get(ctx context.Context, factories component.Factories) (*config.Config, error) { // First check if already an active watching, close that if any. if err := cm.closeIfNeeded(ctx); err != nil { diff --git a/service/config_provider_test.go b/service/config_provider_test.go index a2a395e59e2..93cc5a2ca9a 100644 --- a/service/config_provider_test.go +++ b/service/config_provider_test.go @@ -220,41 +220,6 @@ func TestConfigProvider(t *testing.T) { assert.NoError(t, errC) } -// TODO: Remove when remove MustNewConfigProvider, duplicate of TestConfigProvider. -func TestMustNewConfigProvider(t *testing.T) { - factories, errF := componenttest.NopFactories() - require.NoError(t, errF) - configMapProvider := func() config.MapProvider { - // Use fakeRetrieved with nil errors to have Watchable interface implemented. - cfgMap, err := configtest.LoadConfigMap(filepath.Join("testdata", "otelcol-nop.yaml")) - require.NoError(t, err) - return &mockProvider{retM: cfgMap} - }() - - cfgW := MustNewConfigProvider( - []string{"mock:"}, - map[string]config.MapProvider{"mock": configMapProvider}, - nil, - configunmarshaler.NewDefault()) - - _, errN := cfgW.Get(context.Background(), factories) - assert.NoError(t, errN) - - errW := <-cfgW.Watch() - assert.NoError(t, errW) - - // Repeat Get/Watch. - - _, errN = cfgW.Get(context.Background(), factories) - assert.NoError(t, errN) - - errW = <-cfgW.Watch() - assert.NoError(t, errW) - - errC := cfgW.Shutdown(context.Background()) - assert.NoError(t, errC) -} - func TestConfigProviderNoWatcher(t *testing.T) { factories, errF := componenttest.NopFactories() require.NoError(t, errF) @@ -278,29 +243,6 @@ func TestConfigProviderNoWatcher(t *testing.T) { watcherWG.Wait() } -// TODO: Remove when remove MustNewDefaultConfigProvider, duplicate of TestConfigProviderNoWatcher. -func TestMustNewDefaultConfigProvider(t *testing.T) { - factories, errF := componenttest.NopFactories() - require.NoError(t, errF) - - watcherWG := sync.WaitGroup{} - cfgW := MustNewDefaultConfigProvider([]string{filepath.Join("testdata", "otelcol-nop.yaml")}, nil) - _, errN := cfgW.Get(context.Background(), factories) - assert.NoError(t, errN) - - watcherWG.Add(1) - go func() { - errW, ok := <-cfgW.Watch() - // Channel is closed, no exception - assert.False(t, ok) - assert.NoError(t, errW) - watcherWG.Done() - }() - - assert.NoError(t, cfgW.Shutdown(context.Background())) - watcherWG.Wait() -} - func TestConfigProvider_ShutdownClosesWatch(t *testing.T) { factories, errF := componenttest.NopFactories() require.NoError(t, errF)