Skip to content

Commit 7cdbd1c

Browse files
authored
Rename ServiceExtension to just Extension (#2581)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
1 parent 983bb07 commit 7cdbd1c

File tree

18 files changed

+28
-27
lines changed

18 files changed

+28
-27
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
## 🛑 Breaking changes 🛑
66

7+
- Rename ServiceExtension to just Extension (#2581)
78
- Remove `consumerdata.TraceData` (#2551)
89
- Move `consumerdata.MetricsData` to `internaldata.MetricsData` (#2512)
910
- Remove custom OpenCensus sematic conventions that have equivalent in otel (#2552)

component/component.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ type Host interface {
8282
// Typically is used to find an extension by type or by full config name. Both cases
8383
// can be done by iterating the returned map. There are typically very few extensions
8484
// so there there is no performance implications due to iteration.
85-
GetExtensions() map[configmodels.Extension]ServiceExtension
85+
GetExtensions() map[configmodels.Extension]Extension
8686

8787
// Return map of exporters. Only enabled and created exporters will be returned.
8888
// Typically is used to find exporters by type or by full config name. Both cases

component/componenttest/error_waiting_host.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (ews *ErrorWaitingHost) GetFactory(_ component.Kind, _ configmodels.Type) c
6161
return nil
6262
}
6363

64-
func (ews *ErrorWaitingHost) GetExtensions() map[configmodels.Extension]component.ServiceExtension {
64+
func (ews *ErrorWaitingHost) GetExtensions() map[configmodels.Extension]component.Extension {
6565
return nil
6666
}
6767

component/componenttest/example_factories.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ func (f *ExampleExtensionFactory) CreateDefaultConfig() configmodels.Extension {
473473
}
474474

475475
// CreateExtension creates an Extension based on this config.
476-
func (f *ExampleExtensionFactory) CreateExtension(_ context.Context, _ component.ExtensionCreateParams, _ configmodels.Extension) (component.ServiceExtension, error) {
476+
func (f *ExampleExtensionFactory) CreateExtension(_ context.Context, _ component.ExtensionCreateParams, _ configmodels.Extension) (component.Extension, error) {
477477
if f.FailCreation {
478478
return nil, fmt.Errorf("cannot create %q extension type", f.Type())
479479
}

component/componenttest/nop_host.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (nh *nopHost) GetFactory(_ component.Kind, _ configmodels.Type) component.F
3535
return nil
3636
}
3737

38-
func (nh *nopHost) GetExtensions() map[configmodels.Extension]component.ServiceExtension {
38+
func (nh *nopHost) GetExtensions() map[configmodels.Extension]component.Extension {
3939
return nil
4040
}
4141

component/extension.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,26 @@ import (
2222
"go.opentelemetry.io/collector/config/configmodels"
2323
)
2424

25-
// ServiceExtension is the interface for objects hosted by the OpenTelemetry Collector that
25+
// Extension is the interface for objects hosted by the OpenTelemetry Collector that
2626
// don't participate directly on data pipelines but provide some functionality
2727
// to the service, examples: health check endpoint, z-pages, etc.
28-
type ServiceExtension interface {
28+
type Extension interface {
2929
Component
3030
}
3131

32-
// PipelineWatcher is an extra interface for ServiceExtension hosted by the OpenTelemetry
32+
// PipelineWatcher is an extra interface for Extension hosted by the OpenTelemetry
3333
// Collector that is to be implemented by extensions interested in changes to pipeline
3434
// states. Typically this will be used by extensions that change their behavior if data is
3535
// being ingested or not, e.g.: a k8s readiness probe.
3636
type PipelineWatcher interface {
37-
// Ready notifies the ServiceExtension that all pipelines were built and the
37+
// Ready notifies the Extension that all pipelines were built and the
3838
// receivers were started, i.e.: the service is ready to receive data
3939
// (notice that it may already have received data when this method is called).
4040
Ready() error
4141

42-
// NotReady notifies the ServiceExtension that all receivers are about to be stopped,
42+
// NotReady notifies the Extension that all receivers are about to be stopped,
4343
// i.e.: pipeline receivers will not accept new data.
44-
// This is sent before receivers are stopped, so the ServiceExtension can take any
44+
// This is sent before receivers are stopped, so the Extension can take any
4545
// appropriate action before that happens.
4646
NotReady() error
4747
}
@@ -70,5 +70,5 @@ type ExtensionFactory interface {
7070
CreateDefaultConfig() configmodels.Extension
7171

7272
// CreateExtension creates a service extension based on the given config.
73-
CreateExtension(ctx context.Context, params ExtensionCreateParams, cfg configmodels.Extension) (ServiceExtension, error)
73+
CreateExtension(ctx context.Context, params ExtensionCreateParams, cfg configmodels.Extension) (Extension, error)
7474
}

config/configcheck/configcheck_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,6 @@ func (b badConfigExtensionFactory) CreateDefaultConfig() configmodels.Extension
198198
}{}
199199
}
200200

201-
func (b badConfigExtensionFactory) CreateExtension(_ context.Context, _ component.ExtensionCreateParams, _ configmodels.Extension) (component.ServiceExtension, error) {
201+
func (b badConfigExtensionFactory) CreateExtension(_ context.Context, _ component.ExtensionCreateParams, _ configmodels.Extension) (component.Extension, error) {
202202
return nil, nil
203203
}

extension/extensionhelper/factory.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type FactoryOption func(o *factory)
3030
type CreateDefaultConfig func() configmodels.Extension
3131

3232
// CreateServiceExtension is the equivalent of component.ExtensionFactory.CreateExtension()
33-
type CreateServiceExtension func(context.Context, component.ExtensionCreateParams, configmodels.Extension) (component.ServiceExtension, error)
33+
type CreateServiceExtension func(context.Context, component.ExtensionCreateParams, configmodels.Extension) (component.Extension, error)
3434

3535
type factory struct {
3636
cfgType configmodels.Type
@@ -83,7 +83,7 @@ func (f *factory) CreateDefaultConfig() configmodels.Extension {
8383
func (f *factory) CreateExtension(
8484
ctx context.Context,
8585
params component.ExtensionCreateParams,
86-
cfg configmodels.Extension) (component.ServiceExtension, error) {
86+
cfg configmodels.Extension) (component.Extension, error) {
8787
return f.createServiceExtension(ctx, params, cfg)
8888
}
8989

extension/extensionhelper/factory_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func defaultConfig() configmodels.Extension {
7070
return defaultCfg
7171
}
7272

73-
func createExtension(context.Context, component.ExtensionCreateParams, configmodels.Extension) (component.ServiceExtension, error) {
73+
func createExtension(context.Context, component.ExtensionCreateParams, configmodels.Extension) (component.Extension, error) {
7474
return nopExtensionInstance, nil
7575
}
7676

extension/fluentbitextension/factory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func createDefaultConfig() configmodels.Extension {
4444
}
4545
}
4646

47-
func createExtension(_ context.Context, params component.ExtensionCreateParams, cfg configmodels.Extension) (component.ServiceExtension, error) {
47+
func createExtension(_ context.Context, params component.ExtensionCreateParams, cfg configmodels.Extension) (component.Extension, error) {
4848
config := cfg.(*Config)
4949
return newProcessManager(config, params.Logger), nil
5050
}

0 commit comments

Comments
 (0)