From b5ad07b18bd86f52d331d2fa16d551f23b331c87 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Wed, 7 Feb 2024 00:14:41 -0800 Subject: [PATCH 1/2] [component] Remove host.ReportFatalError --- .chloggen/remove_ReportFatalError.yaml | 25 ++++++++++++++++++++++++ component/componenttest/nop_host.go | 2 -- component/componenttest/nop_host_test.go | 2 -- component/host.go | 10 ---------- service/host.go | 7 ------- 5 files changed, 25 insertions(+), 21 deletions(-) create mode 100755 .chloggen/remove_ReportFatalError.yaml diff --git a/.chloggen/remove_ReportFatalError.yaml b/.chloggen/remove_ReportFatalError.yaml new file mode 100755 index 00000000000..3c3b5e0596d --- /dev/null +++ b/.chloggen/remove_ReportFatalError.yaml @@ -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: Remove `host.ReportFatalError` + +# One or more tracking issues or pull requests related to the change +issues: [6344] + +# (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: [] \ No newline at end of file diff --git a/component/componenttest/nop_host.go b/component/componenttest/nop_host.go index 4accfab0d8c..f0ae4788dfe 100644 --- a/component/componenttest/nop_host.go +++ b/component/componenttest/nop_host.go @@ -15,8 +15,6 @@ func NewNopHost() component.Host { return &nopHost{} } -func (nh *nopHost) ReportFatalError(_ error) {} - func (nh *nopHost) GetFactory(_ component.Kind, _ component.Type) component.Factory { return nil } diff --git a/component/componenttest/nop_host_test.go b/component/componenttest/nop_host_test.go index 99d323681ca..4aada24b1be 100644 --- a/component/componenttest/nop_host_test.go +++ b/component/componenttest/nop_host_test.go @@ -4,7 +4,6 @@ package componenttest import ( - "errors" "testing" "github.com/stretchr/testify/assert" @@ -18,7 +17,6 @@ func TestNewNopHost(t *testing.T) { require.NotNil(t, nh) require.IsType(t, &nopHost{}, nh) - nh.ReportFatalError(errors.New("TestError")) assert.Nil(t, nh.GetExporters()) // nolint: staticcheck assert.Nil(t, nh.GetExtensions()) assert.Nil(t, nh.GetFactory(component.KindReceiver, component.MustNewType("test"))) diff --git a/component/host.go b/component/host.go index 732e37c8c44..4b6933baaef 100644 --- a/component/host.go +++ b/component/host.go @@ -6,16 +6,6 @@ package component // import "go.opentelemetry.io/collector/component" // Host represents the entity that is hosting a Component. It is used to allow communication // between the Component and its host (normally the service.Collector is the host). type Host interface { - // ReportFatalError is used to report to the host that the component - // encountered a fatal error (i.e.: an error that the instance can't recover - // from) after its start function had already returned. - // - // ReportFatalError should be called by the component anytime after Component.Start() ends and - // before Component.Shutdown() begins. - // Deprecated: [0.87.0] Use TelemetrySettings.ReportComponentStatus instead (with an event - // component.StatusFatalError) - ReportFatalError(err error) - // GetFactory of the specified kind. Returns the factory for a component type. // This allows components to create other components. For example: // func (r MyReceiver) Start(host component.Host) error { diff --git a/service/host.go b/service/host.go index b749564b0dd..870e0bfc446 100644 --- a/service/host.go +++ b/service/host.go @@ -30,13 +30,6 @@ type serviceHost struct { serviceExtensions *extensions.Extensions } -// ReportFatalError is used to report to the host that the receiver encountered -// a fatal error (i.e.: an error that the instance can't recover from) after -// its start function has already returned. -// Deprecated: [0.87.0] Replaced by servicetelemetry.Settings.ReportComponentStatus -func (host *serviceHost) ReportFatalError(err error) { - host.asyncErrorChannel <- err -} func (host *serviceHost) GetFactory(kind component.Kind, componentType component.Type) component.Factory { switch kind { case component.KindReceiver: From 1cc11da5c3ff2d87647abaa91f42d0970f1c545e Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Wed, 7 Feb 2024 07:54:11 -0800 Subject: [PATCH 2/2] Update .chloggen/remove_ReportFatalError.yaml Co-authored-by: Pablo Baeyens --- .chloggen/remove_ReportFatalError.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/remove_ReportFatalError.yaml b/.chloggen/remove_ReportFatalError.yaml index 3c3b5e0596d..54f69253e42 100755 --- a/.chloggen/remove_ReportFatalError.yaml +++ b/.chloggen/remove_ReportFatalError.yaml @@ -22,4 +22,4 @@ subtext: # 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: [] \ No newline at end of file +change_logs: [api] \ No newline at end of file