From b9a10cdc6e597afe5e4a8619965fbfbc00708cbc Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Mon, 14 Mar 2022 19:19:49 +0100 Subject: [PATCH] Remove all deprecated funcs/structs from v0.46.0 (#4995) Signed-off-by: Bogdan Drutu --- CHANGELOG.md | 1 + cmd/builder/internal/builder/config.go | 3 -- cmd/builder/internal/builder/config_test.go | 4 +- cmd/builder/internal/builder/main_test.go | 8 ++-- component/componenthelper/component.go | 6 --- config/confighttp/confighttp.go | 3 -- exporter/exporterhelper/common.go | 3 -- exporter/exporterhelper/factory.go | 46 ------------------- exporter/exporterhelper/queued_retry.go | 3 -- .../queued_retry_experimental.go | 3 -- .../exporterhelper/queued_retry_inmemory.go | 3 -- extension/extensionhelper/factory.go | 38 --------------- internal/testcomponents/example_factories.go | 3 -- model/internal/pdata/common.go | 4 +- processor/processorhelper/factory.go | 46 ------------------- receiver/receiverhelper/doc.go | 16 ------- receiver/receiverhelper/factory.go | 46 ------------------- receiver/scraperhelper/scrapercontroller.go | 3 -- 18 files changed, 8 insertions(+), 231 deletions(-) delete mode 100644 exporter/exporterhelper/factory.go delete mode 100644 extension/extensionhelper/factory.go delete mode 100644 processor/processorhelper/factory.go delete mode 100644 receiver/receiverhelper/doc.go delete mode 100644 receiver/receiverhelper/factory.go diff --git a/CHANGELOG.md b/CHANGELOG.md index c4e759d676c..5aab98a374a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Remove `Type` funcs in pdata (#4933) - Rename `pdata.AttributeMap.Delete` to `pdata.AttributeMap.Remove` (#4914) - pdata: deprecate funcs working with InternalRep (#4957) +- Remove all deprecated funcs/structs from v0.46.0 (#4995) ### 💡 Enhancements 💡 diff --git a/cmd/builder/internal/builder/config.go b/cmd/builder/internal/builder/config.go index 43ce82feb48..03400782d72 100644 --- a/cmd/builder/internal/builder/config.go +++ b/cmd/builder/internal/builder/config.go @@ -63,9 +63,6 @@ type Module struct { Path string `mapstructure:"path"` // an optional path to the local version of this module } -// Deprecated: [v0.46.0] Use NewDefaultConfig instead -var DefaultConfig = NewDefaultConfig - // NewDefaultConfig creates a new config, with default values func NewDefaultConfig() Config { log, err := zap.NewDevelopment() diff --git a/cmd/builder/internal/builder/config_test.go b/cmd/builder/internal/builder/config_test.go index 709001a17b3..a33a72de824 100644 --- a/cmd/builder/internal/builder/config_test.go +++ b/cmd/builder/internal/builder/config_test.go @@ -131,8 +131,8 @@ func TestInvalidModule(t *testing.T) { } } -func TestDefaultConfig(t *testing.T) { - cfg := DefaultConfig() +func TestNewDefaultConfig(t *testing.T) { + cfg := NewDefaultConfig() require.NoError(t, cfg.ParseModules()) require.NoError(t, cfg.Validate()) } diff --git a/cmd/builder/internal/builder/main_test.go b/cmd/builder/internal/builder/main_test.go index 5cee3de3f6f..c637438d763 100644 --- a/cmd/builder/internal/builder/main_test.go +++ b/cmd/builder/internal/builder/main_test.go @@ -25,18 +25,18 @@ import ( ) func TestGenerateDefault(t *testing.T) { - require.NoError(t, Generate(DefaultConfig())) + require.NoError(t, Generate(NewDefaultConfig())) } func TestGenerateInvalidCollectorVersion(t *testing.T) { - cfg := DefaultConfig() + cfg := NewDefaultConfig() cfg.Distribution.OtelColVersion = "invalid" err := Generate(cfg) require.NoError(t, err) } func TestGenerateInvalidOutputPath(t *testing.T) { - cfg := DefaultConfig() + cfg := NewDefaultConfig() cfg.Distribution.OutputPath = "/invalid" err := Generate(cfg) require.Error(t, err) @@ -49,7 +49,7 @@ func TestGenerateAndCompileDefault(t *testing.T) { log.Fatal(err) } defer os.RemoveAll(dir) - cfg := DefaultConfig() + cfg := NewDefaultConfig() cfg.Distribution.OutputPath = dir // we override this version, otherwise this would break during releases diff --git a/component/componenthelper/component.go b/component/componenthelper/component.go index 9dedfe0c288..35e8633bcd6 100644 --- a/component/componenthelper/component.go +++ b/component/componenthelper/component.go @@ -18,12 +18,6 @@ import ( "go.opentelemetry.io/collector/component" ) -// Deprecated: [v0.46.0] use component.StartFunc. -type StartFunc = component.StartFunc - -// Deprecated: [v0.46.0] use component.ShutdownFunc. -type ShutdownFunc = component.ShutdownFunc - // Option represents the possible options for New. type Option func(*baseComponent) diff --git a/config/confighttp/confighttp.go b/config/confighttp/confighttp.go index de7ebb41693..8a062efdada 100644 --- a/config/confighttp/confighttp.go +++ b/config/confighttp/confighttp.go @@ -82,9 +82,6 @@ type HTTPClientSettings struct { IdleConnTimeout *time.Duration `mapstructure:"idle_conn_timeout"` } -// Deprecated: [v0.46.0] Use NewDefaultHTTPClientSettings instead. -var DefaultHTTPClientSettings = NewDefaultHTTPClientSettings - // NewDefaultHTTPClientSettings returns HTTPClientSettings type object with // the default values of 'MaxIdleConns' and 'IdleConnTimeout'. // Other config options are not added as they are initialized with 'zero value' by GoLang as default. diff --git a/exporter/exporterhelper/common.go b/exporter/exporterhelper/common.go index 2096bc09090..6f6efbce5b8 100644 --- a/exporter/exporterhelper/common.go +++ b/exporter/exporterhelper/common.go @@ -32,9 +32,6 @@ type TimeoutSettings struct { Timeout time.Duration `mapstructure:"timeout"` } -// Deprecated: [v0.46.0] use NewDefaultTimeoutSettings instead. -var DefaultTimeoutSettings = NewDefaultTimeoutSettings - // NewDefaultTimeoutSettings returns the default settings for TimeoutSettings. func NewDefaultTimeoutSettings() TimeoutSettings { return TimeoutSettings{ diff --git a/exporter/exporterhelper/factory.go b/exporter/exporterhelper/factory.go deleted file mode 100644 index d5ec3a2c5a8..00000000000 --- a/exporter/exporterhelper/factory.go +++ /dev/null @@ -1,46 +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 exporterhelper // import "go.opentelemetry.io/collector/exporter/exporterhelper" - -import ( - "go.opentelemetry.io/collector/component" -) - -// Deprecated: [v0.46.0] use component.ExporterFactoryOption. -type FactoryOption = component.ExporterFactoryOption - -// Deprecated: [v0.46.0] use component.ExporterCreateDefaultConfigFunc. -type CreateDefaultConfig = component.ExporterCreateDefaultConfigFunc - -// Deprecated: [v0.46.0] use component.CreateTracesExporterFunc. -type CreateTracesExporter = component.CreateTracesExporterFunc - -// Deprecated: [v0.46.0] use component.CreateMetricsExporterFunc. -type CreateMetricsExporter = component.CreateMetricsExporterFunc - -// Deprecated: [v0.46.0] use component.CreateLogsExporterFunc. -type CreateLogsExporter = component.CreateLogsExporterFunc - -// Deprecated: [v0.46.0] use component.WithTracesExporter. -var WithTraces = component.WithTracesExporter - -// Deprecated: [v0.46.0] use component.WithMetricsExporter. -var WithMetrics = component.WithMetricsExporter - -// Deprecated: [v0.46.0] use component.WithLogsExporter. -var WithLogs = component.WithLogsExporter - -// Deprecated: [v0.46.0] use component.NewExporterFactory. -var NewFactory = component.NewExporterFactory diff --git a/exporter/exporterhelper/queued_retry.go b/exporter/exporterhelper/queued_retry.go index 3375770d568..85b64bb85b8 100644 --- a/exporter/exporterhelper/queued_retry.go +++ b/exporter/exporterhelper/queued_retry.go @@ -48,9 +48,6 @@ type RetrySettings struct { MaxElapsedTime time.Duration `mapstructure:"max_elapsed_time"` } -// Deprecated: [v0.46.0] use NewDefaultRetrySettings instead. -var DefaultRetrySettings = NewDefaultRetrySettings - // NewDefaultRetrySettings returns the default settings for RetrySettings. func NewDefaultRetrySettings() RetrySettings { return RetrySettings{ diff --git a/exporter/exporterhelper/queued_retry_experimental.go b/exporter/exporterhelper/queued_retry_experimental.go index 4c03410e6df..4153edacdad 100644 --- a/exporter/exporterhelper/queued_retry_experimental.go +++ b/exporter/exporterhelper/queued_retry_experimental.go @@ -48,9 +48,6 @@ type QueueSettings struct { PersistentStorageEnabled bool `mapstructure:"persistent_storage_enabled"` } -// Deprecated: [v0.46.0] use NewDefaultQueueSettings instead. -var DefaultQueueSettings = NewDefaultQueueSettings - // NewDefaultQueueSettings returns the default settings for QueueSettings. func NewDefaultQueueSettings() QueueSettings { return QueueSettings{ diff --git a/exporter/exporterhelper/queued_retry_inmemory.go b/exporter/exporterhelper/queued_retry_inmemory.go index 7dc3a23b83e..ca9a46d448b 100644 --- a/exporter/exporterhelper/queued_retry_inmemory.go +++ b/exporter/exporterhelper/queued_retry_inmemory.go @@ -44,9 +44,6 @@ type QueueSettings struct { QueueSize int `mapstructure:"queue_size"` } -// Deprecated: [v0.46.0] use NewDefaultQueueSettings instead. -var DefaultQueueSettings = NewDefaultQueueSettings - // NewDefaultQueueSettings returns the default settings for QueueSettings. func NewDefaultQueueSettings() QueueSettings { return QueueSettings{ diff --git a/extension/extensionhelper/factory.go b/extension/extensionhelper/factory.go deleted file mode 100644 index fbe55f3bdf4..00000000000 --- a/extension/extensionhelper/factory.go +++ /dev/null @@ -1,38 +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 extensionhelper // import "go.opentelemetry.io/collector/extension/extensionhelper" - -import ( - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/config" -) - -// Deprecated: [v0.46.0] not needed, will be removed soon. -type FactoryOption struct{} - -// Deprecated: [v0.46.0] use component.ExtensionDefaultConfigFunc. -type CreateDefaultConfig = component.ExtensionDefaultConfigFunc - -// Deprecated: [v0.46.0] use component.CreateExtensionFunc. -type CreateServiceExtension = component.CreateExtensionFunc - -// Deprecated: [v0.46.0] use component.NewExtensionFactory. -func NewFactory( - cfgType config.Type, - createDefaultConfig component.ExtensionDefaultConfigFunc, - createServiceExtension component.CreateExtensionFunc, - options ...FactoryOption) component.ExtensionFactory { - return component.NewExtensionFactory(cfgType, createDefaultConfig, createServiceExtension) -} diff --git a/internal/testcomponents/example_factories.go b/internal/testcomponents/example_factories.go index c071bb158c5..0973b125167 100644 --- a/internal/testcomponents/example_factories.go +++ b/internal/testcomponents/example_factories.go @@ -46,9 +46,6 @@ func ExampleComponents() ( return } -// Deprecated: [v0.46.0] use NewDefaultFactories instead. -var DefaultFactories = NewDefaultFactories - // NewDefaultFactories returns the set of components in "testdata/otelcol-config.yaml". This is only used by tests. func NewDefaultFactories() (component.Factories, error) { var errs error diff --git a/model/internal/pdata/common.go b/model/internal/pdata/common.go index 700585edd5a..061bfc0ea11 100644 --- a/model/internal/pdata/common.go +++ b/model/internal/pdata/common.go @@ -511,9 +511,7 @@ func (am AttributeMap) Get(key string) (AttributeValue, bool) { return AttributeValue{nil}, false } -// Delete deletes the entry associated with the key and returns true if the key -// was present in the map, otherwise returns false. -// Deprecated: [v0.46.0] Use Remove instead. +// Deprecated: [v0.47.0] Use Remove instead. func (am AttributeMap) Delete(key string) bool { return am.Remove(key) } diff --git a/processor/processorhelper/factory.go b/processor/processorhelper/factory.go deleted file mode 100644 index 6cf868ccb57..00000000000 --- a/processor/processorhelper/factory.go +++ /dev/null @@ -1,46 +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 processorhelper // import "go.opentelemetry.io/collector/processor/processorhelper" - -import ( - "go.opentelemetry.io/collector/component" -) - -// Deprecated: [v0.46.0] use component.ProcessorFactoryOption. -type FactoryOption = component.ProcessorFactoryOption - -// Deprecated: [v0.46.0] use component.ProcessorCreateDefaultConfigFunc. -type CreateDefaultConfig = component.ProcessorCreateDefaultConfigFunc - -// Deprecated: [v0.46.0] use component.CreateTracesProcessorFunc. -type CreateTracesProcessor = component.CreateTracesProcessorFunc - -// Deprecated: [v0.46.0] use component.CreateMetricsProcessorFunc. -type CreateMetricsProcessor = component.CreateMetricsProcessorFunc - -// Deprecated: [v0.46.0] use component.CreateLogsProcessorFunc. -type CreateLogsProcessor = component.CreateLogsProcessorFunc - -// Deprecated: [v0.46.0] use component.WithTracesProcessor. -var WithTraces = component.WithTracesProcessor - -// Deprecated: [v0.46.0] use component.WithMetricsProcessor. -var WithMetrics = component.WithMetricsProcessor - -// Deprecated: [v0.46.0] use component.WithLogsProcessor. -var WithLogs = component.WithLogsProcessor - -// Deprecated: [v0.46.0] use component.NewProcessorFactory. -var NewFactory = component.NewProcessorFactory diff --git a/receiver/receiverhelper/doc.go b/receiver/receiverhelper/doc.go deleted file mode 100644 index bf82d16d4d6..00000000000 --- a/receiver/receiverhelper/doc.go +++ /dev/null @@ -1,16 +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 receiverhelper contains utilities for receivers. -package receiverhelper // import "go.opentelemetry.io/collector/receiver/receiverhelper" diff --git a/receiver/receiverhelper/factory.go b/receiver/receiverhelper/factory.go deleted file mode 100644 index 6602c31d1e2..00000000000 --- a/receiver/receiverhelper/factory.go +++ /dev/null @@ -1,46 +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 receiverhelper // import "go.opentelemetry.io/collector/receiver/receiverhelper" - -import ( - "go.opentelemetry.io/collector/component" -) - -// Deprecated: [v0.46.0] use component.ReceiverFactoryOption. -type FactoryOption = component.ReceiverFactoryOption - -// Deprecated: [v0.46.0] use component.WithTracesReceiver. -var WithTraces = component.WithTracesReceiver - -// Deprecated: [v0.46.0] use component.WithMetricsReceiver. -var WithMetrics = component.WithMetricsReceiver - -// Deprecated: [v0.46.0] use component.WithLogsReceiver. -var WithLogs = component.WithLogsReceiver - -// Deprecated: [v0.46.0] use component.ReceiverCreateDefaultConfigFunc. -type CreateDefaultConfig = component.ReceiverCreateDefaultConfigFunc - -// Deprecated: [v0.46.0] use component.CreateTracesReceiverFunc. -type CreateTracesReceiver = component.CreateTracesReceiverFunc - -// Deprecated: [v0.46.0] use component.CreateMetricsReceiverFunc. -type CreateMetricsReceiver = component.CreateMetricsReceiverFunc - -// Deprecated: [v0.46.0] use component.CreateLogsReceiverFunc. -type CreateLogsReceiver = component.CreateLogsReceiverFunc - -// Deprecated: [v0.46.0] use component.NewReceiverFactory. -var NewFactory = component.NewReceiverFactory diff --git a/receiver/scraperhelper/scrapercontroller.go b/receiver/scraperhelper/scrapercontroller.go index 10aadef9c6d..8b96c379d87 100644 --- a/receiver/scraperhelper/scrapercontroller.go +++ b/receiver/scraperhelper/scrapercontroller.go @@ -39,9 +39,6 @@ type ScraperControllerSettings struct { CollectionInterval time.Duration `mapstructure:"collection_interval"` } -// Deprecated: [v0.46.0] use NewDefaultScraperControllerSettings instead. -var DefaultScraperControllerSettings = NewDefaultScraperControllerSettings - // NewDefaultScraperControllerSettings returns default scraper controller // settings with a collection interval of one minute. func NewDefaultScraperControllerSettings(cfgType config.Type) ScraperControllerSettings {