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 GetExporters from component.Host #9987

Merged
Merged
Show file tree
Hide file tree
Changes from 4 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
25 changes: 25 additions & 0 deletions .chloggen/component-host-remove-getexporters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# 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: Removed deprecated function `GetExporters` from `component.Host` interface

# One or more tracking issues or pull requests related to the change
issues: [9987]

# (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:

# 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]
1 change: 0 additions & 1 deletion component/componenttest/nop_host_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ func TestNewNopHost(t *testing.T) {
require.NotNil(t, nh)
require.IsType(t, &nopHost{}, nh)

assert.Nil(t, nh.GetExporters()) // nolint: staticcheck
assert.Nil(t, nh.GetExtensions())
assert.Nil(t, nh.GetFactory(component.KindReceiver, component.MustNewType("test")))
}
20 changes: 0 additions & 20 deletions component/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,4 @@ type Host interface {
// GetExtensions can be called by the component anytime after Component.Start() begins and
// until Component.Shutdown() ends.
GetExtensions() map[ID]Component

// GetExporters returns the map of exporters. Only enabled and created exporters will be returned.
// Typically is used to find exporters by type or by full config name. Both cases
// can be done by iterating the returned map. There are typically very few exporters,
// so there are no performance implications due to iteration.
// This returns a map by DataType of maps by exporter configs to the exporter instance.
// Note that an exporter with the same name may be attached to multiple pipelines and
// thus we may have an instance of the exporter for multiple data types.
// This is an experimental function that may change or even be removed completely.
//
// 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
}
5 changes: 5 additions & 0 deletions service/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ import (
"go.opentelemetry.io/collector/service/internal/graph"
)

type getExporters interface {
mx-psi marked this conversation as resolved.
Show resolved Hide resolved
GetExporters() map[component.DataType]map[component.ID]component.Component
}

var _ getExporters = (*serviceHost)(nil)
var _ component.Host = (*serviceHost)(nil)

type serviceHost struct {
Expand Down
Loading