diff --git a/receiver/opencensusreceiver/opencensus.go b/receiver/opencensusreceiver/opencensus.go index 32e091eee1f0..fa36aaf37b6e 100644 --- a/receiver/opencensusreceiver/opencensus.go +++ b/receiver/opencensusreceiver/opencensus.go @@ -105,7 +105,7 @@ func (ocr *ocReceiver) Start(_ context.Context, host component.Host) error { return errors.New("cannot start receiver: no consumers were specified") } - if err := ocr.startServer(host); err != nil { + if err := ocr.startServer(); err != nil { return err } @@ -211,7 +211,7 @@ func (ocr *ocReceiver) httpServer() *http.Server { return ocr.serverHTTP } -func (ocr *ocReceiver) startServer(host component.Host) error { +func (ocr *ocReceiver) startServer() error { // Register the grpc-gateway on the HTTP server mux c := context.Background() opts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())} @@ -241,17 +241,17 @@ func (ocr *ocReceiver) startServer(host component.Host) error { // Check for cmux.ErrServerClosed, because during the shutdown this is not properly close before closing the cmux, // see TODO in Shutdown. if err := ocr.serverGRPC.Serve(grpcL); !errors.Is(err, grpc.ErrServerStopped) && !errors.Is(err, cmux.ErrServerClosed) && err != nil { - host.ReportFatalError(err) + ocr.settings.TelemetrySettings.ReportStatus(component.NewFatalErrorEvent(err)) } }() go func() { if err := ocr.httpServer().Serve(httpL); !errors.Is(err, http.ErrServerClosed) && err != nil { - host.ReportFatalError(err) + ocr.settings.TelemetrySettings.ReportStatus(component.NewFatalErrorEvent(err)) } }() go func() { if err := m.Serve(); !errors.Is(err, cmux.ErrServerClosed) && err != nil { - host.ReportFatalError(err) + ocr.settings.TelemetrySettings.ReportStatus(component.NewFatalErrorEvent(err)) } }() return nil