Skip to content

Commit

Permalink
Remove GetExporters from component.Host (open-telemetry#9987)
Browse files Browse the repository at this point in the history
**Description:** 
Remove the deprecated `GetExporters` function from `component.Host`

**Link to tracking Issue:** <Issue number if applicable>

Related to
open-telemetry#7370
  • Loading branch information
TylerHelmuth authored Apr 22, 2024
1 parent 256c7c3 commit 6611edf
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 21 deletions.
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
}
6 changes: 6 additions & 0 deletions service/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ import (
"go.opentelemetry.io/collector/service/internal/graph"
)

// TODO: remove as part of https://github.com/open-telemetry/opentelemetry-collector/issues/7370 for service 1.0
type getExporters interface {
GetExporters() map[component.DataType]map[component.ID]component.Component
}

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

type serviceHost struct {
Expand Down

0 comments on commit 6611edf

Please sign in to comment.