Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Wobrock committed May 7, 2024
1 parent 1b39bd1 commit abc8f58
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,13 @@ func (rt *Runtime) Serve(ctx context.Context) error {
rt.logger.WithFields(map[string]interface{}{"err": err}).Error("Failed to start OpenTelemetry trace exporter.")
return err
}

defer func() {
err := rt.traceExporter.Shutdown(ctx)
if err != nil {
rt.logger.WithFields(map[string]interface{}{"err": err}).Error("Failed to shutdown OpenTelemetry trace exporter gracefully.")
}
}()
}

rt.server = server.New().
Expand Down Expand Up @@ -856,13 +863,6 @@ func (rt *Runtime) gracefulServerShutdown(s *server.Server) error {
return err
}
rt.logger.Info("Server shutdown.")

if rt.traceExporter != nil {
err = rt.traceExporter.Shutdown(ctx)
if err != nil {
rt.logger.WithFields(map[string]interface{}{"err": err}).Error("Failed to shutdown OpenTelemetry trace exporter gracefully.")
}
}
return nil
}

Expand Down

0 comments on commit abc8f58

Please sign in to comment.