Skip to content

Commit

Permalink
[chore] opencensus receiver ReportFatalError -> ReportStatus (open-te…
Browse files Browse the repository at this point in the history
…lemetry#30502)

**Description:**
Remove use of deprecated host.ReportFatalError

**Link to tracking Issue:**
open-telemetry#30501
  • Loading branch information
atoulme authored Jan 15, 2024
1 parent c0a7714 commit 14bdd68
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions receiver/opencensusreceiver/opencensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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())}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 14bdd68

Please sign in to comment.