Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for deprecated unmarshaler #2591

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Remove `consumerdata.TraceData` (#2551)
- Move `consumerdata.MetricsData` to `internaldata.MetricsData` (#2512)
- Remove custom OpenCensus sematic conventions that have equivalent in otel (#2552)
- Remove support for deprecated unmarshaler `CustomUnmarshaler`, only `Unmarshal` is supported (#2591)
- Remove deprecated componenterror.CombineErrors (#2598)

## v0.21.0 Beta
Expand Down
13 changes: 3 additions & 10 deletions component/componenttest/example_factories.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ func (f *ExampleReceiverFactory) CreateDefaultConfig() configmodels.Receiver {
}
}

// CustomUnmarshaler implements the deprecated way to provide custom unmarshalers.
func (f *ExampleReceiverFactory) CustomUnmarshaler() component.CustomUnmarshaler {
return nil
}

// CreateTraceReceiver creates a trace receiver based on this config.
func (f *ExampleReceiverFactory) CreateTracesReceiver(
_ context.Context,
Expand Down Expand Up @@ -280,11 +275,9 @@ func (f *ExampleExporterFactory) CreateDefaultConfig() configmodels.Exporter {
}
}

// CustomUnmarshaler implements the deprecated way to provide custom unmarshalers.
func (f *ExampleExporterFactory) CustomUnmarshaler() component.CustomUnmarshaler {
return func(componentViperSection *viper.Viper, intoCfg interface{}) error {
return componentViperSection.UnmarshalExact(intoCfg)
}
// Unmarshal implements the custom unmarshalers.
func (f *ExampleExporterFactory) Unmarshal(componentViperSection *viper.Viper, intoCfg interface{}) error {
return componentViperSection.UnmarshalExact(intoCfg)
}

// CreateTracesExporter creates a trace exporter based on this config.
Expand Down
16 changes: 0 additions & 16 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,6 @@ type pipelineSettings struct {
Exporters []string `mapstructure:"exporters"`
}

// deprecatedUnmarshaler is the old/deprecated way to provide custom unmarshaler.
type deprecatedUnmarshaler interface {
// CustomUnmarshaler returns a custom unmarshaler for the configuration or nil if
// there is no need for custom unmarshaling. This is typically used if viper.UnmarshalExact()
// is not sufficient to unmarshal correctly.
CustomUnmarshaler() component.CustomUnmarshaler
}

// typeAndNameSeparator is the separator that is used between type and name in type/name composite keys.
const typeAndNameSeparator = "/"

Expand Down Expand Up @@ -736,14 +728,6 @@ func unmarshaler(factory component.Factory) component.CustomUnmarshaler {
if fu, ok := factory.(component.ConfigUnmarshaler); ok {
return fu.Unmarshal
}

if du, ok := factory.(deprecatedUnmarshaler); ok {
cu := du.CustomUnmarshaler()
if cu != nil {
return cu
}
}

return defaultUnmarshaler
}

Expand Down