diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fafc6ebf5d..0dc7629b4fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - Remove `configtest.NewViperFromYamlFile()`, use `config.Parser.NewParserFromFile()` (#2806) - Move `config.ViperSubExact()` to use `config.Parser.Sub()` (#2806) - Update LoadReceiver signature to remove unused params (#2823) +- Move `configerror.ErrDataTypeIsNotSupported` to `componenterror.ErrDataTypeIsNotSupported` (#2886) ## 💡 Enhancements 💡 diff --git a/component/componenterror/errors.go b/component/componenterror/errors.go index a58742c5bcc..314bb040973 100644 --- a/component/componenterror/errors.go +++ b/component/componenterror/errors.go @@ -29,4 +29,9 @@ var ( // ErrNilNextConsumer indicates an error on nil next consumer. ErrNilNextConsumer = errors.New("nil nextConsumer") + + // ErrDataTypeIsNotSupported can be returned by receiver, exporter or processor + // factory methods that create the entity if the particular telemetry + // data type is not supported by the receiver, exporter or processor. + ErrDataTypeIsNotSupported = errors.New("telemetry type is not supported") ) diff --git a/component/componenttest/shutdown_verifier.go b/component/componenttest/shutdown_verifier.go index e1f7afd6e13..0c5bff835d1 100644 --- a/component/componenttest/shutdown_verifier.go +++ b/component/componenttest/shutdown_verifier.go @@ -23,8 +23,8 @@ import ( "go.uber.org/zap" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/config" - "go.opentelemetry.io/collector/config/configerror" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/internal/testdata" ) @@ -39,7 +39,7 @@ func verifyTraceProcessorDoesntProduceAfterShutdown(t *testing.T, factory compon nextSink, ) if err != nil { - if err == configerror.ErrDataTypeIsNotSupported { + if err == componenterror.ErrDataTypeIsNotSupported { return } require.NoError(t, err) diff --git a/component/exporter_test.go b/component/exporter_test.go index 36aa1aecfad..78ca1dc89e2 100644 --- a/component/exporter_test.go +++ b/component/exporter_test.go @@ -20,8 +20,8 @@ import ( "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/config" - "go.opentelemetry.io/collector/config/configerror" ) type TestExporterFactory struct { @@ -40,17 +40,17 @@ func (f *TestExporterFactory) CreateDefaultConfig() config.Exporter { // CreateTraceExporter creates a trace exporter based on this config. func (f *TestExporterFactory) CreateTracesExporter(context.Context, ExporterCreateParams, config.Exporter) (TracesExporter, error) { - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } // CreateMetricsExporter creates a metrics exporter based on this config. func (f *TestExporterFactory) CreateMetricsExporter(context.Context, ExporterCreateParams, config.Exporter) (MetricsExporter, error) { - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } // CreateMetricsExporter creates a logs exporter based on this config. func (f *TestExporterFactory) CreateLogsExporter(context.Context, ExporterCreateParams, config.Exporter) (LogsExporter, error) { - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } func TestBuildExporters(t *testing.T) { diff --git a/component/processor_test.go b/component/processor_test.go index 4162556c7a4..b1c7b4d026c 100644 --- a/component/processor_test.go +++ b/component/processor_test.go @@ -20,8 +20,8 @@ import ( "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/config" - "go.opentelemetry.io/collector/config/configerror" "go.opentelemetry.io/collector/consumer" ) @@ -41,17 +41,17 @@ func (f *TestProcessorFactory) CreateDefaultConfig() config.Processor { // CreateTraceProcessor creates a trace processor based on this config. func (f *TestProcessorFactory) CreateTracesProcessor(context.Context, ProcessorCreateParams, config.Processor, consumer.Traces) (TracesProcessor, error) { - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } // CreateMetricsProcessor creates a metrics processor based on this config. func (f *TestProcessorFactory) CreateMetricsProcessor(context.Context, ProcessorCreateParams, config.Processor, consumer.Metrics) (MetricsProcessor, error) { - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } // CreateMetricsProcessor creates a metrics processor based on this config. func (f *TestProcessorFactory) CreateLogsProcessor(context.Context, ProcessorCreateParams, config.Processor, consumer.Logs) (LogsProcessor, error) { - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } func TestFactoriesBuilder(t *testing.T) { diff --git a/component/receiver_test.go b/component/receiver_test.go index 935bb166c91..a06ab08f40f 100644 --- a/component/receiver_test.go +++ b/component/receiver_test.go @@ -20,8 +20,8 @@ import ( "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/config" - "go.opentelemetry.io/collector/config/configerror" "go.opentelemetry.io/collector/consumer" ) @@ -41,17 +41,17 @@ func (f *TestReceiverFactory) CreateDefaultConfig() config.Receiver { // CreateTraceReceiver creates a trace receiver based on this config. func (f *TestReceiverFactory) CreateTracesReceiver(context.Context, ReceiverCreateParams, config.Receiver, consumer.Traces) (TracesReceiver, error) { - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } // CreateMetricsReceiver creates a metrics receiver based on this config. func (f *TestReceiverFactory) CreateMetricsReceiver(context.Context, ReceiverCreateParams, config.Receiver, consumer.Metrics) (MetricsReceiver, error) { - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } // CreateMetricsReceiver creates a metrics receiver based on this config. func (f *TestReceiverFactory) CreateLogsReceiver(context.Context, ReceiverCreateParams, config.Receiver, consumer.Logs) (LogsReceiver, error) { - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } func TestBuildReceivers(t *testing.T) { diff --git a/config/configerror/configerror.go b/config/configerror/configerror.go deleted file mode 100644 index fe694ad4b34..00000000000 --- a/config/configerror/configerror.go +++ /dev/null @@ -1,23 +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 configerror contains the common errors caused by malformed configs. -package configerror - -import "errors" - -// ErrDataTypeIsNotSupported can be returned by receiver, exporter or processor -// factory methods that create the entity if the particular telemetry -// data type is not supported by the receiver, exporter or processor. -var ErrDataTypeIsNotSupported = errors.New("telemetry type is not supported") diff --git a/exporter/exporterhelper/factory.go b/exporter/exporterhelper/factory.go index d4fa9ed5526..d3295bf7d09 100644 --- a/exporter/exporterhelper/factory.go +++ b/exporter/exporterhelper/factory.go @@ -20,8 +20,8 @@ import ( "github.com/spf13/viper" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/config" - "go.opentelemetry.io/collector/config/configerror" ) // FactoryOption apply changes to ExporterOptions. @@ -115,7 +115,7 @@ func (f *factory) CreateTracesExporter( if f.createTracesExporter != nil { return f.createTracesExporter(ctx, params, cfg) } - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } // CreateMetricsExporter creates a component.MetricsExporter based on this config. @@ -126,7 +126,7 @@ func (f *factory) CreateMetricsExporter( if f.createMetricsExporter != nil { return f.createMetricsExporter(ctx, params, cfg) } - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } // CreateLogsExporter creates a metrics processor based on this config. @@ -138,7 +138,7 @@ func (f *factory) CreateLogsExporter( if f.createLogsExporter != nil { return f.createLogsExporter(ctx, params, cfg) } - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } var _ component.ConfigUnmarshaler = (*factoryWithUnmarshaler)(nil) diff --git a/exporter/exporterhelper/factory_test.go b/exporter/exporterhelper/factory_test.go index 7f9c4e6dcfc..d2f10b5f1ce 100644 --- a/exporter/exporterhelper/factory_test.go +++ b/exporter/exporterhelper/factory_test.go @@ -24,8 +24,8 @@ import ( "go.uber.org/zap" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/config" - "go.opentelemetry.io/collector/config/configerror" "go.opentelemetry.io/collector/consumer/pdata" ) @@ -56,11 +56,11 @@ func TestNewFactory(t *testing.T) { _, ok := factory.(component.ConfigUnmarshaler) assert.False(t, ok) _, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, defaultCfg) - assert.Equal(t, configerror.ErrDataTypeIsNotSupported, err) + assert.Equal(t, componenterror.ErrDataTypeIsNotSupported, err) _, err = factory.CreateMetricsExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, defaultCfg) - assert.Equal(t, configerror.ErrDataTypeIsNotSupported, err) + assert.Equal(t, componenterror.ErrDataTypeIsNotSupported, err) _, err = factory.CreateLogsExporter(context.Background(), component.ExporterCreateParams{Logger: zap.NewNop()}, defaultCfg) - assert.Equal(t, configerror.ErrDataTypeIsNotSupported, err) + assert.Equal(t, componenterror.ErrDataTypeIsNotSupported, err) } func TestNewFactory_WithConstructors(t *testing.T) { diff --git a/exporter/jaegerexporter/factory_test.go b/exporter/jaegerexporter/factory_test.go index 2d4233c2395..bbe797bc0fd 100644 --- a/exporter/jaegerexporter/factory_test.go +++ b/exporter/jaegerexporter/factory_test.go @@ -22,8 +22,8 @@ import ( "go.uber.org/zap" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/config/configcheck" - "go.opentelemetry.io/collector/config/configerror" ) func TestCreateDefaultConfig(t *testing.T) { @@ -39,7 +39,7 @@ func TestCreateMetricsExporter(t *testing.T) { params := component.ExporterCreateParams{Logger: zap.NewNop()} _, err := factory.CreateMetricsExporter(context.Background(), params, cfg) - assert.Error(t, err, configerror.ErrDataTypeIsNotSupported) + assert.Error(t, err, componenterror.ErrDataTypeIsNotSupported) } func TestCreateInstanceViaFactory(t *testing.T) { diff --git a/processor/attributesprocessor/factory_test.go b/processor/attributesprocessor/factory_test.go index a4f7c6293ee..31bef0dc2f2 100644 --- a/processor/attributesprocessor/factory_test.go +++ b/processor/attributesprocessor/factory_test.go @@ -22,9 +22,9 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/config" "go.opentelemetry.io/collector/config/configcheck" - "go.opentelemetry.io/collector/config/configerror" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/processor/processorhelper" ) @@ -94,7 +94,7 @@ func TestFactory_CreateMetricsProcessor(t *testing.T) { mp, err := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, nil) require.Nil(t, mp) - assert.Equal(t, err, configerror.ErrDataTypeIsNotSupported) + assert.Equal(t, err, componenterror.ErrDataTypeIsNotSupported) } func TestFactoryCreateLogsProcessor_EmptyActions(t *testing.T) { diff --git a/processor/processorhelper/factory.go b/processor/processorhelper/factory.go index cd7dd16ac8e..b4ddee4ca8d 100644 --- a/processor/processorhelper/factory.go +++ b/processor/processorhelper/factory.go @@ -20,8 +20,8 @@ import ( "github.com/spf13/viper" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/config" - "go.opentelemetry.io/collector/config/configerror" "go.opentelemetry.io/collector/consumer" ) @@ -118,7 +118,7 @@ func (f *factory) CreateTracesProcessor( if f.createTraceProcessor != nil { return f.createTraceProcessor(ctx, params, cfg, nextConsumer) } - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } // CreateMetricsProcessor creates a component.MetricsProcessor based on this config. @@ -131,7 +131,7 @@ func (f *factory) CreateMetricsProcessor( if f.createMetricsProcessor != nil { return f.createMetricsProcessor(ctx, params, cfg, nextConsumer) } - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } // CreateLogsProcessor creates a component.LogsProcessor based on this config. @@ -144,7 +144,7 @@ func (f *factory) CreateLogsProcessor( if f.createLogsProcessor != nil { return f.createLogsProcessor(ctx, params, cfg, nextConsumer) } - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } var _ component.ConfigUnmarshaler = (*factoryWithUnmarshaler)(nil) diff --git a/processor/spanprocessor/factory_test.go b/processor/spanprocessor/factory_test.go index 7a41a7d046e..474eb34ead5 100644 --- a/processor/spanprocessor/factory_test.go +++ b/processor/spanprocessor/factory_test.go @@ -24,9 +24,9 @@ import ( "go.uber.org/zap" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/config" "go.opentelemetry.io/collector/config/configcheck" - "go.opentelemetry.io/collector/config/configerror" "go.opentelemetry.io/collector/consumer/consumertest" ) @@ -103,5 +103,5 @@ func TestFactory_CreateMetricProcessor(t *testing.T) { mp, err := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, nil) require.Nil(t, mp) - assert.Equal(t, err, configerror.ErrDataTypeIsNotSupported) + assert.Equal(t, err, componenterror.ErrDataTypeIsNotSupported) } diff --git a/receiver/hostmetricsreceiver/factory_test.go b/receiver/hostmetricsreceiver/factory_test.go index ebb478bbcef..294fea0f88b 100644 --- a/receiver/hostmetricsreceiver/factory_test.go +++ b/receiver/hostmetricsreceiver/factory_test.go @@ -23,8 +23,8 @@ import ( "go.uber.org/zap" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/config/configcheck" - "go.opentelemetry.io/collector/config/configerror" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/receiver/hostmetricsreceiver/internal" ) @@ -43,7 +43,7 @@ func TestCreateReceiver(t *testing.T) { cfg := factory.CreateDefaultConfig() tReceiver, err := factory.CreateTracesReceiver(context.Background(), creationParams, cfg, consumertest.NewTracesNop()) - assert.Equal(t, err, configerror.ErrDataTypeIsNotSupported) + assert.Equal(t, err, componenterror.ErrDataTypeIsNotSupported) assert.Nil(t, tReceiver) mReceiver, err := factory.CreateMetricsReceiver(context.Background(), creationParams, cfg, consumertest.NewMetricsNop()) @@ -51,7 +51,7 @@ func TestCreateReceiver(t *testing.T) { assert.NotNil(t, mReceiver) tLogs, err := factory.CreateLogsReceiver(context.Background(), creationParams, cfg, consumertest.NewLogsNop()) - assert.Equal(t, err, configerror.ErrDataTypeIsNotSupported) + assert.Equal(t, err, componenterror.ErrDataTypeIsNotSupported) assert.Nil(t, tLogs) } diff --git a/receiver/jaegerreceiver/factory_test.go b/receiver/jaegerreceiver/factory_test.go index 5dee435e299..0a99dea70dc 100644 --- a/receiver/jaegerreceiver/factory_test.go +++ b/receiver/jaegerreceiver/factory_test.go @@ -25,10 +25,10 @@ import ( "go.uber.org/zap" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config" "go.opentelemetry.io/collector/config/configcheck" - "go.opentelemetry.io/collector/config/configerror" "go.opentelemetry.io/collector/config/configgrpc" "go.opentelemetry.io/collector/config/confighttp" "go.opentelemetry.io/collector/config/confignet" @@ -65,7 +65,7 @@ func TestCreateReceiver(t *testing.T) { assert.NotNil(t, tReceiver, "receiver creation failed") mReceiver, err := factory.CreateMetricsReceiver(context.Background(), params, cfg, nil) - assert.Equal(t, err, configerror.ErrDataTypeIsNotSupported) + assert.Equal(t, err, componenterror.ErrDataTypeIsNotSupported) assert.Nil(t, mReceiver) } @@ -89,7 +89,7 @@ func TestCreateReceiverGeneralConfig(t *testing.T) { assert.NotNil(t, tReceiver, "receiver creation failed") mReceiver, err := factory.CreateMetricsReceiver(context.Background(), params, rCfg, nil) - assert.Equal(t, err, configerror.ErrDataTypeIsNotSupported) + assert.Equal(t, err, componenterror.ErrDataTypeIsNotSupported) assert.Nil(t, mReceiver) } diff --git a/receiver/receiverhelper/factory.go b/receiver/receiverhelper/factory.go index f902273ed5d..51274c76105 100644 --- a/receiver/receiverhelper/factory.go +++ b/receiver/receiverhelper/factory.go @@ -20,8 +20,8 @@ import ( "github.com/spf13/viper" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/config" - "go.opentelemetry.io/collector/config/configerror" "go.opentelemetry.io/collector/consumer" ) @@ -117,7 +117,7 @@ func (f *factory) CreateTracesReceiver( if f.createTraceReceiver != nil { return f.createTraceReceiver(ctx, params, cfg, nextConsumer) } - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } // CreateMetricsReceiver creates a component.MetricsReceiver based on this config. @@ -129,7 +129,7 @@ func (f *factory) CreateMetricsReceiver( if f.createMetricsReceiver != nil { return f.createMetricsReceiver(ctx, params, cfg, nextConsumer) } - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } // CreateLogsReceiver creates a metrics processor based on this config. @@ -142,7 +142,7 @@ func (f *factory) CreateLogsReceiver( if f.createLogsReceiver != nil { return f.createLogsReceiver(ctx, params, cfg, nextConsumer) } - return nil, configerror.ErrDataTypeIsNotSupported + return nil, componenterror.ErrDataTypeIsNotSupported } var _ component.ConfigUnmarshaler = (*factoryWithUnmarshaler)(nil) diff --git a/service/defaultcomponents/default_exporters_test.go b/service/defaultcomponents/default_exporters_test.go index 665c7c100d6..b474d6db5d3 100644 --- a/service/defaultcomponents/default_exporters_test.go +++ b/service/defaultcomponents/default_exporters_test.go @@ -26,8 +26,8 @@ import ( "go.uber.org/zap" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/config" - "go.opentelemetry.io/collector/config/configerror" "go.opentelemetry.io/collector/config/configgrpc" "go.opentelemetry.io/collector/exporter/fileexporter" "go.opentelemetry.io/collector/exporter/jaegerexporter" @@ -180,7 +180,7 @@ func verifyExporterLifecycle(t *testing.T, factory component.ExporterFactory, ge for _, createFn := range createFns { firstExp, err := createFn(ctx, expCreateParams, getConfigFn()) - if errors.Is(err, configerror.ErrDataTypeIsNotSupported) { + if errors.Is(err, componenterror.ErrDataTypeIsNotSupported) { continue } require.NoError(t, err) diff --git a/service/defaultcomponents/default_processors_test.go b/service/defaultcomponents/default_processors_test.go index a2d0e7863b7..4676e73b12e 100644 --- a/service/defaultcomponents/default_processors_test.go +++ b/service/defaultcomponents/default_processors_test.go @@ -25,8 +25,8 @@ import ( "go.uber.org/zap" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/config" - "go.opentelemetry.io/collector/config/configerror" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/processor/attributesprocessor" "go.opentelemetry.io/collector/processor/memorylimiter" @@ -134,7 +134,7 @@ func verifyProcessorLifecycle(t *testing.T, factory component.ProcessorFactory, for _, createFn := range createFns { firstExp, err := createFn(ctx, processorCreateParams, getConfigFn()) - if errors.Is(err, configerror.ErrDataTypeIsNotSupported) { + if errors.Is(err, componenterror.ErrDataTypeIsNotSupported) { continue } require.NoError(t, err) diff --git a/service/defaultcomponents/default_receivers_test.go b/service/defaultcomponents/default_receivers_test.go index 0919e4769d1..50c16a9175f 100644 --- a/service/defaultcomponents/default_receivers_test.go +++ b/service/defaultcomponents/default_receivers_test.go @@ -25,8 +25,8 @@ import ( "go.uber.org/zap" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/config" - "go.opentelemetry.io/collector/config/configerror" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/receiver/prometheusreceiver" ) @@ -122,7 +122,7 @@ func verifyReceiverLifecycle(t *testing.T, factory component.ReceiverFactory, ge for _, createFn := range createFns { firstRcvr, err := createFn(ctx, receiverCreateParams, getConfigFn()) - if errors.Is(err, configerror.ErrDataTypeIsNotSupported) { + if errors.Is(err, componenterror.ErrDataTypeIsNotSupported) { continue } require.NoError(t, err) diff --git a/service/internal/builder/exporters_builder.go b/service/internal/builder/exporters_builder.go index a1cefbf1784..b0df7f832d4 100644 --- a/service/internal/builder/exporters_builder.go +++ b/service/internal/builder/exporters_builder.go @@ -21,8 +21,8 @@ import ( "go.uber.org/zap" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/config" - "go.opentelemetry.io/collector/config/configerror" "go.opentelemetry.io/collector/consumer/consumererror" ) @@ -256,7 +256,7 @@ func (eb *exportersBuilder) buildExporter( } if err != nil { - if err == configerror.ErrDataTypeIsNotSupported { + if err == componenterror.ErrDataTypeIsNotSupported { // Could not create because this exporter does not support this data type. return nil, exporterTypeMismatchErr(cfg, requirement.requiredBy, dataType) } diff --git a/service/internal/builder/receivers_builder.go b/service/internal/builder/receivers_builder.go index e3141b5865a..0e71a87cd9b 100644 --- a/service/internal/builder/receivers_builder.go +++ b/service/internal/builder/receivers_builder.go @@ -22,8 +22,8 @@ import ( "go.uber.org/zap" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenterror" "go.opentelemetry.io/collector/config" - "go.opentelemetry.io/collector/config/configerror" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumererror" "go.opentelemetry.io/collector/consumer/fanoutconsumer" @@ -192,11 +192,11 @@ func (rb *receiversBuilder) attachReceiverToPipelines( createdReceiver, err = factory.CreateLogsReceiver(ctx, creationParams, cfg, junction) default: - err = configerror.ErrDataTypeIsNotSupported + err = componenterror.ErrDataTypeIsNotSupported } if err != nil { - if err == configerror.ErrDataTypeIsNotSupported { + if err == componenterror.ErrDataTypeIsNotSupported { return fmt.Errorf( "receiver %s does not support %s but it was used in a "+ "%s pipeline",