Deprecate component.Host.GetExporters (#7390)

Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>
This commit is contained in:
Daniel Jaglowski 2023-05-26 16:34:08 -06:00 committed by GitHub
parent 87dd85a6c0
commit fe2ae8defc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,16 @@
# 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: component
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Deprecate Host.GetExporters function
# One or more tracking issues or pull requests related to the change
issues: [7370]
# (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:

View File

@ -19,7 +19,7 @@ func TestNewNopHost(t *testing.T) {
require.IsType(t, &nopHost{}, nh)
nh.ReportFatalError(errors.New("TestError"))
assert.Nil(t, nh.GetExporters())
assert.Nil(t, nh.GetExporters()) // nolint: staticcheck
assert.Nil(t, nh.GetExtensions())
assert.Nil(t, nh.GetFactory(component.KindReceiver, "test"))
}

View File

@ -47,5 +47,12 @@ type Host interface {
//
// GetExporters can be called by the component anytime after Component.Start() begins and
// until Component.Shutdown() ends.
//
// Deprecated: [0.79.0] This function will be removed in the future.
// Several components in the contrib repository use this function so it cannot be removed
// before those cases are removed. In most cases, use of this function can be replaced by a
// connector. See https://github.com/open-telemetry/opentelemetry-collector/issues/7370 and
// https://github.com/open-telemetry/opentelemetry-collector/pull/7390#issuecomment-1483710184
// for additional information.
GetExporters() map[DataType]map[ID]Component
}

View File

@ -57,6 +57,12 @@ func (host *serviceHost) GetExtensions() map[component.ID]component.Component {
return host.serviceExtensions.GetExtensions()
}
// Deprecated: [0.79.0] This function will be removed in the future.
// Several components in the contrib repository use this function so it cannot be removed
// before those cases are removed. In most cases, use of this function can be replaced by a
// connector. See https://github.com/open-telemetry/opentelemetry-collector/issues/7370 and
// https://github.com/open-telemetry/opentelemetry-collector/pull/7390#issuecomment-1483710184
// for additional information.
func (host *serviceHost) GetExporters() map[component.DataType]map[component.ID]component.Component {
return host.pipelines.GetExporters()
}

View File

@ -310,6 +310,12 @@ func (g *Graph) ShutdownAll(ctx context.Context) error {
return errs
}
// Deprecated: [0.79.0] This function will be removed in the future.
// Several components in the contrib repository use this function so it cannot be removed
// before those cases are removed. In most cases, use of this function can be replaced by a
// connector. See https://github.com/open-telemetry/opentelemetry-collector/issues/7370 and
// https://github.com/open-telemetry/opentelemetry-collector/pull/7390#issuecomment-1483710184
// for additional information.
func (g *Graph) GetExporters() map[component.DataType]map[component.ID]component.Component {
exportersMap := make(map[component.DataType]map[component.ID]component.Component)
exportersMap[component.DataTypeTraces] = make(map[component.ID]component.Component)