From 70f6de1625c3ff37d499d7043cf9c65f80f923e6 Mon Sep 17 00:00:00 2001 From: Thomas Poignant Date: Fri, 11 Oct 2024 17:10:35 +0200 Subject: [PATCH] fix: don't stary Otel when no configuration --- cmd/relayproxy/api/server.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cmd/relayproxy/api/server.go b/cmd/relayproxy/api/server.go index 85a69f2e44a..a64d16b4450 100644 --- a/cmd/relayproxy/api/server.go +++ b/cmd/relayproxy/api/server.go @@ -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 @@ -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)) }