Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executor trace b3 propagate #1445

Merged
merged 7 commits into from
Feb 18, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions executor/api/tracing/trace.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package tracing

import (
"github.com/opentracing/opentracing-go"
jaegercfg "github.com/uber/jaeger-client-go/config"
"github.com/uber/jaeger-client-go/zipkin"
"io"
)

func NewTraceByPropagation(propagation string, cfg *jaegercfg.Configuration) (closer io.Closer, err error) {
andrewshaoyu marked this conversation as resolved.
Show resolved Hide resolved
switch propagation {
case "b3":
return newB3Tracer(cfg)
}
return newDefaultTracer(cfg)
}

func newB3Tracer(cfg *jaegercfg.Configuration) (io.Closer, error) {
zipkinPropagator := zipkin.NewZipkinB3HTTPHeaderPropagator()
closer, err := cfg.InitGlobalTracer(cfg.ServiceName,
jaegercfg.Injector(opentracing.HTTPHeaders, zipkinPropagator),
jaegercfg.Extractor(opentracing.HTTPHeaders, zipkinPropagator),
jaegercfg.ZipkinSharedRPCSpan(true))
return closer, err
}
func newDefaultTracer(cfg *jaegercfg.Configuration) (io.Closer, error) {
closer, err := cfg.InitGlobalTracer(cfg.ServiceName)
return closer, err
}
8 changes: 3 additions & 5 deletions executor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"fmt"
"github.com/ghodss/yaml"
"github.com/go-logr/logr"
"github.com/opentracing/opentracing-go"
"github.com/prometheus/common/log"
"github.com/seldonio/seldon-core/executor/api"
seldonclient "github.com/seldonio/seldon-core/executor/api/client"
Expand All @@ -17,6 +16,7 @@ import (
"github.com/seldonio/seldon-core/executor/api/grpc/seldon/proto"
"github.com/seldonio/seldon-core/executor/api/grpc/tensorflow"
"github.com/seldonio/seldon-core/executor/api/rest"
"github.com/seldonio/seldon-core/executor/api/tracing"
loghandler "github.com/seldonio/seldon-core/executor/logger"
"github.com/seldonio/seldon-core/executor/proto/tensorflow/serving"
"github.com/seldonio/seldon-core/operator/apis/machinelearning/v1"
Expand Down Expand Up @@ -173,13 +173,11 @@ func initTracing() io.Closer {
cfg.ServiceName = "executor"
}

tracer, closer, err := cfg.NewTracer()
propagation := os.Getenv("JAEGER_TRACE_PROPAGATION_TYPE")
andrewshaoyu marked this conversation as resolved.
Show resolved Hide resolved
closer, err := tracing.NewTraceByPropagation(propagation, cfg)
if err != nil {
log.Fatal("Could not initialize jaeger tracer:", err.Error())
}

opentracing.SetGlobalTracer(tracer)

return closer
}

Expand Down