Skip to content

Commit 70f6de1

Browse files
fix: don't stary Otel when no configuration
1 parent 5179a2a commit 70f6de1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

cmd/relayproxy/api/server.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,12 @@ func (s *Server) Start() {
119119
}
120120

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

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

138-
err = s.apiEcho.Start(address)
140+
err := s.apiEcho.Start(address)
139141
if err != nil && !errors.Is(err, http.ErrServerClosed) {
140142
s.zapLog.Fatal("Error starting relay proxy", zap.Error(err))
141143
}

0 commit comments

Comments
 (0)