diff --git a/.chloggen/codeboten_create-settings-extension.yaml b/.chloggen/codeboten_create-settings-extension.yaml new file mode 100644 index 00000000000..e882d026ab1 --- /dev/null +++ b/.chloggen/codeboten_create-settings-extension.yaml @@ -0,0 +1,28 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: deprecation + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: extension + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Deprecate CreateSettings and NewNopCreateSettings + +# One or more tracking issues or pull requests related to the change +issues: [9428] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: | + The following methods are being renamed: + - extension.CreateSettings -> extension.Settings + - extension.NewNopCreateSettings -> extension.NewNopSettings + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [api] diff --git a/cmd/mdatagen/templates/component_telemetry_test.go.tmpl b/cmd/mdatagen/templates/component_telemetry_test.go.tmpl index 5ee950c270f..33372616141 100644 --- a/cmd/mdatagen/templates/component_telemetry_test.go.tmpl +++ b/cmd/mdatagen/templates/component_telemetry_test.go.tmpl @@ -21,7 +21,6 @@ type componentTestTelemetry struct { meterProvider *sdkmetric.MeterProvider } -{{- if (or isExporter isReceiver isProcessor isConnector) }} func (tt *componentTestTelemetry) NewSettings() {{ .Status.Class }}.Settings { settings := {{ .Status.Class }}test.NewNopSettings() settings.MeterProvider = tt.meterProvider @@ -30,16 +29,6 @@ func (tt *componentTestTelemetry) NewSettings() {{ .Status.Class }}.Settings { return settings } -{{ else }} -func (tt *componentTestTelemetry) NewCreateSettings() {{ .Status.Class }}.CreateSettings { - settings := {{ .Status.Class }}test.NewNopCreateSettings() - settings.MeterProvider = tt.meterProvider - settings.ID = component.NewID(component.MustNewType("{{ .Type }}")) - - return settings -} - -{{ end }} func setupTestTelemetry() componentTestTelemetry { reader := sdkmetric.NewManualReader() return componentTestTelemetry{ diff --git a/cmd/mdatagen/templates/component_test.go.tmpl b/cmd/mdatagen/templates/component_test.go.tmpl index 45106fe65d4..45deb99e545 100644 --- a/cmd/mdatagen/templates/component_test.go.tmpl +++ b/cmd/mdatagen/templates/component_test.go.tmpl @@ -337,7 +337,7 @@ func TestComponentLifecycle(t *testing.T) { {{- if not .Tests.SkipShutdown }} t.Run("shutdown", func(t *testing.T) { - e, err := factory.CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + e, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) err = e.Shutdown(context.Background()) require.NoError(t, err) @@ -346,12 +346,12 @@ func TestComponentLifecycle(t *testing.T) { {{- if not .Tests.SkipLifecycle }} t.Run("lifecycle", func(t *testing.T) { - firstExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + firstExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) require.NoError(t, firstExt.Start(context.Background(), componenttest.NewNopHost())) require.NoError(t, firstExt.Shutdown(context.Background())) - secondExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + secondExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) require.NoError(t, secondExt.Start(context.Background(), componenttest.NewNopHost())) require.NoError(t, secondExt.Shutdown(context.Background())) diff --git a/exporter/internal/queue/persistent_queue_test.go b/exporter/internal/queue/persistent_queue_test.go index ee3bc7b7c5f..f226e35c430 100644 --- a/exporter/internal/queue/persistent_queue_test.go +++ b/exporter/internal/queue/persistent_queue_test.go @@ -324,7 +324,7 @@ func TestInvalidStorageExtensionType(t *testing.T) { // make a test extension factory := extensiontest.NewNopFactory() extConfig := factory.CreateDefaultConfig() - settings := extensiontest.NewNopCreateSettings() + settings := extensiontest.NewNopSettings() extension, err := factory.CreateExtension(context.Background(), settings, extConfig) assert.NoError(t, err) var extensions = map[component.ID]component.Component{ diff --git a/extension/ballastextension/factory.go b/extension/ballastextension/factory.go index b1742d9081b..730950da7d4 100644 --- a/extension/ballastextension/factory.go +++ b/extension/ballastextension/factory.go @@ -26,6 +26,6 @@ func createDefaultConfig() component.Config { return &Config{} } -func createExtension(_ context.Context, set extension.CreateSettings, cfg component.Config) (extension.Extension, error) { +func createExtension(_ context.Context, set extension.Settings, cfg component.Config) (extension.Extension, error) { return newMemoryBallast(cfg.(*Config), set.TelemetrySettings.Logger, memHandler), nil } diff --git a/extension/ballastextension/factory_test.go b/extension/ballastextension/factory_test.go index 810d093cd86..0c9e91f8224 100644 --- a/extension/ballastextension/factory_test.go +++ b/extension/ballastextension/factory_test.go @@ -19,14 +19,14 @@ func TestFactory_CreateDefaultConfig(t *testing.T) { assert.Equal(t, &Config{}, cfg) assert.NoError(t, componenttest.CheckConfigStruct(cfg)) - ext, err := createExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + ext, err := createExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) require.NotNil(t, ext) } func TestFactory_CreateExtension(t *testing.T) { cfg := createDefaultConfig().(*Config) - ext, err := createExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + ext, err := createExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) require.NotNil(t, ext) } diff --git a/extension/ballastextension/generated_component_test.go b/extension/ballastextension/generated_component_test.go index 2e685378c41..d70b7d0498d 100644 --- a/extension/ballastextension/generated_component_test.go +++ b/extension/ballastextension/generated_component_test.go @@ -31,18 +31,18 @@ func TestComponentLifecycle(t *testing.T) { require.NoError(t, err) require.NoError(t, sub.Unmarshal(&cfg)) t.Run("shutdown", func(t *testing.T) { - e, err := factory.CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + e, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) err = e.Shutdown(context.Background()) require.NoError(t, err) }) t.Run("lifecycle", func(t *testing.T) { - firstExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + firstExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) require.NoError(t, firstExt.Start(context.Background(), componenttest.NewNopHost())) require.NoError(t, firstExt.Shutdown(context.Background())) - secondExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + secondExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) require.NoError(t, secondExt.Start(context.Background(), componenttest.NewNopHost())) require.NoError(t, secondExt.Shutdown(context.Background())) diff --git a/extension/extension.go b/extension/extension.go index 292358b33ba..8ee61a422cc 100644 --- a/extension/extension.go +++ b/extension/extension.go @@ -63,7 +63,12 @@ type StatusWatcher interface { } // CreateSettings is passed to Factory.Create(...) function. -type CreateSettings struct { +// +// Deprecated: [v0.103.0] Use extension.Settings instead. +type CreateSettings = Settings + +// Settings is passed to Factory.Create(...) function. +type Settings struct { // ID returns the ID of the component that will be created. ID component.ID @@ -74,10 +79,10 @@ type CreateSettings struct { } // CreateFunc is the equivalent of Factory.Create(...) function. -type CreateFunc func(context.Context, CreateSettings, component.Config) (Extension, error) +type CreateFunc func(context.Context, Settings, component.Config) (Extension, error) // CreateExtension implements Factory.Create. -func (f CreateFunc) CreateExtension(ctx context.Context, set CreateSettings, cfg component.Config) (Extension, error) { +func (f CreateFunc) CreateExtension(ctx context.Context, set Settings, cfg component.Config) (Extension, error) { return f(ctx, set, cfg) } @@ -85,7 +90,7 @@ type Factory interface { component.Factory // CreateExtension creates an extension based on the given config. - CreateExtension(ctx context.Context, set CreateSettings, cfg component.Config) (Extension, error) + CreateExtension(ctx context.Context, set Settings, cfg component.Config) (Extension, error) // ExtensionStability gets the stability level of the Extension. ExtensionStability() component.StabilityLevel @@ -149,7 +154,7 @@ func NewBuilder(cfgs map[component.ID]component.Config, factories map[component. } // Create creates an extension based on the settings and configs available. -func (b *Builder) Create(ctx context.Context, set CreateSettings) (Extension, error) { +func (b *Builder) Create(ctx context.Context, set Settings) (Extension, error) { cfg, existsCfg := b.cfgs[set.ID] if !existsCfg { return nil, fmt.Errorf("extension %q is not configured", set.ID) diff --git a/extension/extension_test.go b/extension/extension_test.go index d3dbf80c8c3..3c4b2968667 100644 --- a/extension/extension_test.go +++ b/extension/extension_test.go @@ -17,7 +17,7 @@ import ( type nopExtension struct { component.StartFunc component.ShutdownFunc - CreateSettings + Settings } func TestNewFactory(t *testing.T) { @@ -28,7 +28,7 @@ func TestNewFactory(t *testing.T) { factory := NewFactory( testType, func() component.Config { return &defaultCfg }, - func(context.Context, CreateSettings, component.Config) (Extension, error) { + func(context.Context, Settings, component.Config) (Extension, error) { return nopExtensionInstance, nil }, component.StabilityLevelDevelopment) @@ -36,7 +36,7 @@ func TestNewFactory(t *testing.T) { assert.EqualValues(t, &defaultCfg, factory.CreateDefaultConfig()) assert.Equal(t, component.StabilityLevelDevelopment, factory.ExtensionStability()) - ext, err := factory.CreateExtension(context.Background(), CreateSettings{}, &defaultCfg) + ext, err := factory.CreateExtension(context.Background(), Settings{}, &defaultCfg) assert.NoError(t, err) assert.Same(t, nopExtensionInstance, ext) } @@ -88,8 +88,8 @@ func TestBuilder(t *testing.T) { NewFactory( testType, func() component.Config { return &defaultCfg }, - func(_ context.Context, settings CreateSettings, _ component.Config) (Extension, error) { - return nopExtension{CreateSettings: settings}, nil + func(_ context.Context, settings Settings, _ component.Config) (Extension, error) { + return nopExtension{Settings: settings}, nil }, component.StabilityLevelDevelopment), }...) @@ -105,7 +105,7 @@ func TestBuilder(t *testing.T) { // Check that the extension has access to the resource attributes. nop, ok := e.(nopExtension) assert.True(t, ok) - assert.Equal(t, nop.CreateSettings.Resource.Attributes().Len(), 0) + assert.Equal(t, nop.Settings.Resource.Attributes().Len(), 0) missingType, err := b.Create(context.Background(), createSettings(unknownID)) assert.EqualError(t, err, "extension factory not available for: \"unknown\"") @@ -127,8 +127,8 @@ func TestBuilderFactory(t *testing.T) { assert.Nil(t, b.Factory(component.MustNewID("bar").Type())) } -func createSettings(id component.ID) CreateSettings { - return CreateSettings{ +func createSettings(id component.ID) Settings { + return Settings{ ID: id, TelemetrySettings: componenttest.NewNopTelemetrySettings(), BuildInfo: component.NewDefaultBuildInfo(), diff --git a/extension/extensiontest/nop_extension.go b/extension/extensiontest/nop_extension.go index 134eee042a7..9378e6024bd 100644 --- a/extension/extensiontest/nop_extension.go +++ b/extension/extensiontest/nop_extension.go @@ -16,8 +16,15 @@ import ( var nopType = component.MustNewType("nop") // NewNopCreateSettings returns a new nop settings for extension.Factory Create* functions. -func NewNopCreateSettings() extension.CreateSettings { - return extension.CreateSettings{ +// +// Deprecated: [v0.103.0] Use extensiontest.NewNopSettings instead. +func NewNopCreateSettings() extension.Settings { + return NewNopSettings() +} + +// NewNopSettings returns a new nop settings for extension.Factory Create* functions. +func NewNopSettings() extension.Settings { + return extension.Settings{ ID: component.NewIDWithName(nopType, uuid.NewString()), TelemetrySettings: componenttest.NewNopTelemetrySettings(), BuildInfo: component.NewDefaultBuildInfo(), @@ -31,7 +38,7 @@ func NewNopFactory() extension.Factory { func() component.Config { return &nopConfig{} }, - func(context.Context, extension.CreateSettings, component.Config) (extension.Extension, error) { + func(context.Context, extension.Settings, component.Config) (extension.Extension, error) { return nopInstance, nil }, component.StabilityLevelStable) diff --git a/extension/extensiontest/nop_extension_test.go b/extension/extensiontest/nop_extension_test.go index 7ebda6195ae..6daa4331f47 100644 --- a/extension/extensiontest/nop_extension_test.go +++ b/extension/extensiontest/nop_extension_test.go @@ -21,7 +21,7 @@ func TestNewNopFactory(t *testing.T) { cfg := factory.CreateDefaultConfig() assert.Equal(t, &nopConfig{}, cfg) - traces, err := factory.CreateExtension(context.Background(), NewNopCreateSettings(), cfg) + traces, err := factory.CreateExtension(context.Background(), NewNopSettings(), cfg) require.NoError(t, err) assert.NoError(t, traces.Start(context.Background(), componenttest.NewNopHost())) assert.NoError(t, traces.Shutdown(context.Background())) @@ -33,7 +33,7 @@ func TestNewNopBuilder(t *testing.T) { factory := NewNopFactory() cfg := factory.CreateDefaultConfig() - set := NewNopCreateSettings() + set := NewNopSettings() set.ID = component.NewID(nopType) ext, err := factory.CreateExtension(context.Background(), set, cfg) diff --git a/extension/extensiontest/statuswatcher_extension.go b/extension/extensiontest/statuswatcher_extension.go index eee0db94165..a4d78f9033e 100644 --- a/extension/extensiontest/statuswatcher_extension.go +++ b/extension/extensiontest/statuswatcher_extension.go @@ -12,8 +12,8 @@ import ( ) // NewStatusWatcherExtensionCreateSettings returns a new nop settings for Create*Extension functions. -func NewStatusWatcherExtensionCreateSettings() extension.CreateSettings { - return extension.CreateSettings{ +func NewStatusWatcherExtensionCreateSettings() extension.Settings { + return extension.Settings{ TelemetrySettings: componenttest.NewNopTelemetrySettings(), BuildInfo: component.NewDefaultBuildInfo(), } @@ -28,7 +28,7 @@ func NewStatusWatcherExtensionFactory( func() component.Config { return &struct{}{} }, - func(context.Context, extension.CreateSettings, component.Config) (component.Component, error) { + func(context.Context, extension.Settings, component.Config) (component.Component, error) { return &statusWatcherExtension{onStatusChanged: onStatusChanged}, nil }, component.StabilityLevelStable) diff --git a/extension/memorylimiterextension/factory.go b/extension/memorylimiterextension/factory.go index 55b8efec5ea..b253e619483 100644 --- a/extension/memorylimiterextension/factory.go +++ b/extension/memorylimiterextension/factory.go @@ -28,6 +28,6 @@ func createDefaultConfig() component.Config { return &Config{} } -func createExtension(_ context.Context, set extension.CreateSettings, cfg component.Config) (extension.Extension, error) { +func createExtension(_ context.Context, set extension.Settings, cfg component.Config) (extension.Extension, error) { return newMemoryLimiter(cfg.(*Config), set.TelemetrySettings.Logger) } diff --git a/extension/memorylimiterextension/factory_test.go b/extension/memorylimiterextension/factory_test.go index 21bae72ee6d..45bd06675aa 100644 --- a/extension/memorylimiterextension/factory_test.go +++ b/extension/memorylimiterextension/factory_test.go @@ -37,7 +37,7 @@ func TestCreateExtension(t *testing.T) { pCfg.MemorySpikeLimitMiB = 1907 pCfg.CheckInterval = 100 * time.Millisecond - tp, err := factory.CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + tp, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg) assert.NoError(t, err) assert.NotNil(t, tp) // test if we can shutdown a monitoring routine that has not started diff --git a/extension/memorylimiterextension/generated_component_test.go b/extension/memorylimiterextension/generated_component_test.go index b410b246b94..51b6002e0a8 100644 --- a/extension/memorylimiterextension/generated_component_test.go +++ b/extension/memorylimiterextension/generated_component_test.go @@ -31,12 +31,12 @@ func TestComponentLifecycle(t *testing.T) { require.NoError(t, err) require.NoError(t, sub.Unmarshal(&cfg)) t.Run("lifecycle", func(t *testing.T) { - firstExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + firstExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) require.NoError(t, firstExt.Start(context.Background(), componenttest.NewNopHost())) require.NoError(t, firstExt.Shutdown(context.Background())) - secondExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + secondExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) require.NoError(t, secondExt.Start(context.Background(), componenttest.NewNopHost())) require.NoError(t, secondExt.Shutdown(context.Background())) diff --git a/extension/zpagesextension/factory.go b/extension/zpagesextension/factory.go index ecb94cc0f97..dd6dda58645 100644 --- a/extension/zpagesextension/factory.go +++ b/extension/zpagesextension/factory.go @@ -30,6 +30,6 @@ func createDefaultConfig() component.Config { } // createExtension creates the extension based on this config. -func createExtension(_ context.Context, set extension.CreateSettings, cfg component.Config) (extension.Extension, error) { +func createExtension(_ context.Context, set extension.Settings, cfg component.Config) (extension.Extension, error) { return newServer(cfg.(*Config), set.TelemetrySettings), nil } diff --git a/extension/zpagesextension/factory_test.go b/extension/zpagesextension/factory_test.go index fc1bcc512a1..ba36df32175 100644 --- a/extension/zpagesextension/factory_test.go +++ b/extension/zpagesextension/factory_test.go @@ -26,7 +26,7 @@ func TestFactory_CreateDefaultConfig(t *testing.T) { cfg) assert.NoError(t, componenttest.CheckConfigStruct(cfg)) - ext, err := createExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + ext, err := createExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) require.NotNil(t, ext) } @@ -35,7 +35,7 @@ func TestFactory_CreateExtension(t *testing.T) { cfg := createDefaultConfig().(*Config) cfg.TCPAddr.Endpoint = testutil.GetAvailableLocalAddress(t) - ext, err := createExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + ext, err := createExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) require.NotNil(t, ext) } diff --git a/extension/zpagesextension/generated_component_test.go b/extension/zpagesextension/generated_component_test.go index 8caba7a6d95..fba4d348c4b 100644 --- a/extension/zpagesextension/generated_component_test.go +++ b/extension/zpagesextension/generated_component_test.go @@ -31,18 +31,18 @@ func TestComponentLifecycle(t *testing.T) { require.NoError(t, err) require.NoError(t, sub.Unmarshal(&cfg)) t.Run("shutdown", func(t *testing.T) { - e, err := factory.CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + e, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) err = e.Shutdown(context.Background()) require.NoError(t, err) }) t.Run("lifecycle", func(t *testing.T) { - firstExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + firstExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) require.NoError(t, firstExt.Start(context.Background(), componenttest.NewNopHost())) require.NoError(t, firstExt.Shutdown(context.Background())) - secondExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + secondExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) require.NoError(t, secondExt.Start(context.Background(), componenttest.NewNopHost())) require.NoError(t, secondExt.Shutdown(context.Background())) diff --git a/service/extensions/extensions.go b/service/extensions/extensions.go index e05c5aa01f0..c8f632965ca 100644 --- a/service/extensions/extensions.go +++ b/service/extensions/extensions.go @@ -183,7 +183,7 @@ func New(ctx context.Context, set Settings, cfg Config) (*Extensions, error) { ID: extID, Kind: component.KindExtension, } - extSet := extension.CreateSettings{ + extSet := extension.Settings{ ID: extID, TelemetrySettings: set.Telemetry.ToComponentTelemetrySettings(instanceID), BuildInfo: set.BuildInfo, diff --git a/service/extensions/extensions_test.go b/service/extensions/extensions_test.go index d447582bd54..d519132d3f3 100644 --- a/service/extensions/extensions_test.go +++ b/service/extensions/extensions_test.go @@ -158,10 +158,10 @@ func (tc testOrderCase) testOrdering(t *testing.T) { var startOrder []string var shutdownOrder []string - recordingExtensionFactory := newRecordingExtensionFactory(func(set extension.CreateSettings, _ component.Host) error { + recordingExtensionFactory := newRecordingExtensionFactory(func(set extension.Settings, _ component.Host) error { startOrder = append(startOrder, set.ID.String()) return nil - }, func(set extension.CreateSettings) error { + }, func(set extension.Settings) error { shutdownOrder = append(shutdownOrder, set.ID.String()) return nil }) @@ -326,7 +326,7 @@ func newConfigWatcherExtensionFactory(name component.Type, fn func() error) exte func() component.Config { return &struct{}{} }, - func(context.Context, extension.CreateSettings, component.Config) (extension.Extension, error) { + func(context.Context, extension.Settings, component.Config) (extension.Extension, error) { return newConfigWatcherExtension(fn), nil }, component.StabilityLevelDevelopment, @@ -339,7 +339,7 @@ func newBadExtensionFactory() extension.Factory { func() component.Config { return &struct{}{} }, - func(context.Context, extension.CreateSettings, component.Config) (extension.Extension, error) { + func(context.Context, extension.Settings, component.Config) (extension.Extension, error) { return nil, nil }, component.StabilityLevelDevelopment, @@ -352,7 +352,7 @@ func newCreateErrorExtensionFactory() extension.Factory { func() component.Config { return &struct{}{} }, - func(context.Context, extension.CreateSettings, component.Config) (extension.Extension, error) { + func(context.Context, extension.Settings, component.Config) (extension.Extension, error) { return nil, errors.New("cannot create \"err\" extension type") }, component.StabilityLevelDevelopment, @@ -476,20 +476,20 @@ func newStatusTestExtensionFactory(name component.Type, startErr, shutdownErr er func() component.Config { return &struct{}{} }, - func(context.Context, extension.CreateSettings, component.Config) (extension.Extension, error) { + func(context.Context, extension.Settings, component.Config) (extension.Extension, error) { return newStatusTestExtension(startErr, shutdownErr), nil }, component.StabilityLevelDevelopment, ) } -func newRecordingExtensionFactory(startCallback func(set extension.CreateSettings, host component.Host) error, shutdownCallback func(set extension.CreateSettings) error) extension.Factory { +func newRecordingExtensionFactory(startCallback func(set extension.Settings, host component.Host) error, shutdownCallback func(set extension.Settings) error) extension.Factory { return extension.NewFactory( component.MustNewType("recording"), func() component.Config { return &recordingExtensionConfig{} }, - func(_ context.Context, set extension.CreateSettings, cfg component.Config) (extension.Extension, error) { + func(_ context.Context, set extension.Settings, cfg component.Config) (extension.Extension, error) { return &recordingExtension{ config: cfg.(recordingExtensionConfig), createSettings: set, @@ -507,9 +507,9 @@ type recordingExtensionConfig struct { type recordingExtension struct { config recordingExtensionConfig - startCallback func(set extension.CreateSettings, host component.Host) error - shutdownCallback func(set extension.CreateSettings) error - createSettings extension.CreateSettings + startCallback func(set extension.Settings, host component.Host) error + shutdownCallback func(set extension.Settings) error + createSettings extension.Settings } var _ extension.Dependent = (*recordingExtension)(nil) diff --git a/service/service_test.go b/service/service_test.go index f8c0ad4dc4f..f708a82fb0d 100644 --- a/service/service_test.go +++ b/service/service_test.go @@ -599,7 +599,7 @@ func newConfigWatcherExtensionFactory(name component.Type) extension.Factory { func() component.Config { return &struct{}{} }, - func(context.Context, extension.CreateSettings, component.Config) (extension.Extension, error) { + func(context.Context, extension.Settings, component.Config) (extension.Extension, error) { return &configWatcherExtension{}, nil }, component.StabilityLevelDevelopment,