Skip to content

Commit

Permalink
[chore]ReportComponentStatus -> ReportStatus (#30386)
Browse files Browse the repository at this point in the history
Move off deprecated `ReportComponentStatus` to `ReportStatus`. See
open-telemetry/opentelemetry-collector#9148
for rationale.
  • Loading branch information
atoulme authored Jan 10, 2024
1 parent e955822 commit b411e78
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion extension/healthcheckextension/healthcheckextension.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (hc *healthCheckExtension) Start(_ context.Context, host component.Host) er

// The listener ownership goes to the server.
if err = hc.server.Serve(ln); !errors.Is(err, http.ErrServerClosed) && err != nil {
_ = hc.settings.ReportComponentStatus(component.NewFatalErrorEvent(err))
hc.settings.ReportStatus(component.NewFatalErrorEvent(err))
}
}()
} else {
Expand Down
2 changes: 1 addition & 1 deletion extension/jaegerremotesampling/internal/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (h *SamplingHTTPServer) Start(_ context.Context, host component.Host) error
defer h.shutdownWG.Done()

if err := h.srv.Serve(hln); err != nil && !errors.Is(err, http.ErrServerClosed) {
_ = h.telemetry.ReportComponentStatus(component.NewFatalErrorEvent(err))
h.telemetry.ReportStatus(component.NewFatalErrorEvent(err))
}
}()

Expand Down
2 changes: 1 addition & 1 deletion extension/observer/ecsobserver/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (e *ecsObserver) Start(_ context.Context, _ component.Host) error {
if err := e.sd.runAndWriteFile(ctx); err != nil {
e.telemetrySettings.Logger.Error("ECSDiscovery stopped by error", zap.Error(err))
// Stop the collector
_ = e.telemetrySettings.ReportComponentStatus(component.NewFatalErrorEvent(err))
e.telemetrySettings.ReportStatus(component.NewFatalErrorEvent(err))
}
}()
return nil
Expand Down
3 changes: 1 addition & 2 deletions extension/observer/ecsobserver/extension_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ func TestExtensionStartStop(t *testing.T) {
sdCfg.ResultFile = "testdata/ut_ext_critical_error.actual.yaml"
cs := extensiontest.NewNopCreateSettings()
statusEventChan := make(chan *component.StatusEvent)
cs.TelemetrySettings.ReportComponentStatus = func(e *component.StatusEvent) error {
cs.TelemetrySettings.ReportStatus = func(e *component.StatusEvent) {
statusEventChan <- e
return nil
}
ext, err := createExtensionWithFetcher(cs, sdCfg, f)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion extension/remotetapextension/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (s *remoteObserverExtension) Start(_ context.Context, host component.Host)
go func() {
err := s.server.ListenAndServe()
if err != nil && !errors.Is(err, http.ErrServerClosed) {
_ = s.settings.TelemetrySettings.ReportComponentStatus(component.NewFatalErrorEvent(err))
s.settings.TelemetrySettings.ReportStatus(component.NewFatalErrorEvent(err))
}
}()
return nil
Expand Down
4 changes: 2 additions & 2 deletions receiver/cloudflarereceiver/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (l *logsReceiver) startListening(ctx context.Context, _ component.Host) err

if !errors.Is(err, http.ErrServerClosed) {
l.logger.Error("ServeTLS failed", zap.Error(err))
_ = l.telemetrySettings.ReportComponentStatus(component.NewFatalErrorEvent(err))
l.telemetrySettings.ReportStatus(component.NewFatalErrorEvent(err))
}

} else {
Expand All @@ -123,7 +123,7 @@ func (l *logsReceiver) startListening(ctx context.Context, _ component.Host) err

if !errors.Is(err, http.ErrServerClosed) {
l.logger.Error("Serve failed", zap.Error(err))
_ = l.telemetrySettings.ReportComponentStatus(component.NewFatalErrorEvent(err))
l.telemetrySettings.ReportStatus(component.NewFatalErrorEvent(err))
}

}
Expand Down
2 changes: 1 addition & 1 deletion receiver/collectdreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (cdr *collectdReceiver) Start(_ context.Context, host component.Host) error
}
go func() {
if err := cdr.server.Serve(l); !errors.Is(err, http.ErrServerClosed) && err != nil {
_ = cdr.createSettings.TelemetrySettings.ReportComponentStatus(component.NewFatalErrorEvent(err))
cdr.createSettings.TelemetrySettings.ReportStatus(component.NewFatalErrorEvent(err))
}
}()
return nil
Expand Down

0 comments on commit b411e78

Please sign in to comment.