Skip to content

Commit

Permalink
Remove support for deprecated unmarshaler (#2591)
Browse files Browse the repository at this point in the history
Updates #2540

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu authored Mar 5, 2021
1 parent 2f38767 commit 68871bd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,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

0 comments on commit 68871bd

Please # to comment.