Skip to content

Commit 6ff18ae

Browse files
committed
cmd/server: do not read JAEGER env directly
Signed-off-by: Javi Fontan <[email protected]>
1 parent a44658e commit 6ff18ae

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

cmd/gitbase/command/server.go

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package command
22

33
import (
4-
"fmt"
54
"net"
65
"os"
76
"path/filepath"
@@ -14,7 +13,6 @@ import (
1413
"github.com/opentracing/opentracing-go"
1514
gopilosa "github.com/pilosa/go-pilosa"
1615
"github.com/sirupsen/logrus"
17-
jaeger "github.com/uber/jaeger-client-go"
1816
"github.com/uber/jaeger-client-go/config"
1917
sqle "gopkg.in/src-d/go-mysql-server.v0"
2018
"gopkg.in/src-d/go-mysql-server.v0/server"
@@ -81,17 +79,17 @@ func (c *Server) Execute(args []string) error {
8179

8280
var tracer opentracing.Tracer
8381
if c.TraceEnabled {
84-
if os.Getenv("JAEGER_SERVICE_NAME") == "" {
85-
os.Setenv("JAEGER_SERVICE_NAME", TracerServiceName)
86-
}
87-
8882
cfg, err := config.FromEnv()
8983
if err != nil {
9084
logrus.WithField("error", err).
9185
Fatal("unable to read jaeger environment")
9286
return err
9387
}
9488

89+
if cfg.ServiceName == "" {
90+
cfg.ServiceName = TracerServiceName
91+
}
92+
9593
logger := &jaegerLogrus{logrus.WithField("subsystem", "jaeger")}
9694

9795
t, closer, err := cfg.NewTracer(
@@ -106,18 +104,7 @@ func (c *Server) Execute(args []string) error {
106104
tracer = t
107105
defer closer.Close()
108106

109-
jaegerHost := os.Getenv("JAEGER_AGENT_HOST")
110-
if jaegerHost == "" {
111-
jaegerHost = jaeger.DefaultUDPSpanServerHost
112-
}
113-
114-
jaegerPort := os.Getenv("JAEGER_AGENT_PORT")
115-
if jaegerPort == "" {
116-
jaegerPort = strconv.Itoa(jaeger.DefaultUDPSpanServerPort)
117-
}
118-
119-
endpoint := fmt.Sprintf("%s:%s", jaegerHost, jaegerPort)
120-
logrus.WithField("endpoint", endpoint).Info("tracing enabled")
107+
logrus.Info("tracing enabled")
121108
}
122109

123110
hostString := net.JoinHostPort(c.Host, strconv.Itoa(c.Port))

0 commit comments

Comments
 (0)