Skip to content

Commit 012659f

Browse files
fix(tracing): Restore OTel tracing support (thomaspoignant#2482)
Signed-off-by: Dave Henderson <[email protected]>
1 parent f45f594 commit 012659f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cmd/relayproxy/api/server.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package api
22

33
import (
4+
"context"
45
"errors"
56
"fmt"
67
"net/http"
@@ -117,6 +118,13 @@ func (s *Server) Start() {
117118
defer func() { _ = s.monitoringEcho.Close() }()
118119
}
119120

121+
// 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
126+
}
127+
120128
// starting the main application
121129
if s.config.ListenPort == 0 {
122130
s.config.ListenPort = 1031
@@ -127,7 +135,7 @@ func (s *Server) Start() {
127135
zap.String("address", address),
128136
zap.String("version", s.config.Version))
129137

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

0 commit comments

Comments
 (0)