Skip to content

Commit

Permalink
fix: don't stary Otel when no configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspoignant committed Oct 11, 2024
1 parent 5179a2a commit 70f6de1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cmd/relayproxy/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,12 @@ func (s *Server) Start() {
}

// start the OpenTelemetry tracing service
err := s.otelService.Init(context.Background(), *s.config)
if err != nil {
s.zapLog.Error("error while initializing Otel", zap.Error(err))
// we can continue because otel is not mandatory to start the server
if s.config.OpenTelemetryOtlpEndpoint != "" {
err := s.otelService.Init(context.Background(), *s.config)
if err != nil {
s.zapLog.Error("error while initializing Otel", zap.Error(err))
// we can continue because otel is not mandatory to start the server
}
}

// starting the main application
Expand All @@ -135,7 +137,7 @@ func (s *Server) Start() {
zap.String("address", address),
zap.String("version", s.config.Version))

err = s.apiEcho.Start(address)
err := s.apiEcho.Start(address)
if err != nil && !errors.Is(err, http.ErrServerClosed) {
s.zapLog.Fatal("Error starting relay proxy", zap.Error(err))
}
Expand Down

0 comments on commit 70f6de1

Please sign in to comment.