Skip to content

Commit

Permalink
fix(tracing): Restore OTel tracing support (#2482)
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Henderson <[email protected]>
  • Loading branch information
hairyhenderson authored Oct 9, 2024
1 parent f45f594 commit 012659f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/relayproxy/api/server.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package api

import (
"context"
"errors"
"fmt"
"net/http"
Expand Down Expand Up @@ -117,6 +118,13 @@ func (s *Server) Start() {
defer func() { _ = s.monitoringEcho.Close() }()
}

// 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
}

// starting the main application
if s.config.ListenPort == 0 {
s.config.ListenPort = 1031
Expand All @@ -127,7 +135,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 012659f

Please sign in to comment.