diff --git a/cmd/dependency/base/option.go b/cmd/dependency/base/option.go index abb71703a..dcb4baf0f 100644 --- a/cmd/dependency/base/option.go +++ b/cmd/dependency/base/option.go @@ -32,6 +32,9 @@ type TracingConfig struct { // Endpoint is the endpoint to report tracing log, example: "localhost:4317". Endpoint string `yaml:"endpoint" mapstructure:"endpoint"` + // Path is the path to the tracing server, example: "/v1/traces" if the protocol is "http" or "https". + Path string `yaml:"path" mapstructure:"path"` + // ServiceName is the name of the service for tracing. ServiceName string `yaml:"service-name" mapstructure:"service-name"` diff --git a/cmd/dependency/dependency.go b/cmd/dependency/dependency.go index f719ef6fd..7cd600d23 100644 --- a/cmd/dependency/dependency.go +++ b/cmd/dependency/dependency.go @@ -151,9 +151,13 @@ func initJaegerTracer(ctx context.Context, tracingConfig base.TracingConfig) (fu ) switch tracingConfig.Protocol { - case "http", "https": - addr := fmt.Sprintf("%s://%s", tracingConfig.Protocol, tracingConfig.Endpoint) - exporter, err = otlptracehttp.New(ctx, otlptracehttp.WithEndpointURL(addr), otlptracehttp.WithInsecure()) + case "http": + exporter, err = otlptracehttp.New(ctx, otlptracehttp.WithEndpoint(tracingConfig.Endpoint), otlptracehttp.WithURLPath(tracingConfig.Path), otlptracehttp.WithInsecure()) + if err != nil { + return nil, fmt.Errorf("could not create HTTP trace exporter: %w", err) + } + case "https": + exporter, err = otlptracehttp.New(ctx, otlptracehttp.WithEndpoint(tracingConfig.Endpoint), otlptracehttp.WithURLPath(tracingConfig.Path)) if err != nil { return nil, fmt.Errorf("could not create HTTP trace exporter: %w", err) } diff --git a/deploy/docker-compose/template/client.template.yaml b/deploy/docker-compose/template/client.template.yaml index 4517ceb51..f0a71db14 100644 --- a/deploy/docker-compose/template/client.template.yaml +++ b/deploy/docker-compose/template/client.template.yaml @@ -212,8 +212,3 @@ metrics: port: 4002 # # ip is the listen ip of the metrics server. # ip: "" - -# # tracing is the tracing configuration for dfdaemon. -# tracing: -# # addr is the address to report tracing log. -# addr: "" diff --git a/deploy/docker-compose/template/manager.template.yaml b/deploy/docker-compose/template/manager.template.yaml index e54380672..dd8bd23dd 100644 --- a/deploy/docker-compose/template/manager.template.yaml +++ b/deploy/docker-compose/template/manager.template.yaml @@ -164,7 +164,3 @@ console: false # Listen port for pprof, default is -1 (means disabled). pprofPort: -1 - -tracing: - # Jaeger endpoint url, like: http://jaeger.dragonfly.svc:4317. - addr: '' diff --git a/deploy/docker-compose/template/scheduler.template.yaml b/deploy/docker-compose/template/scheduler.template.yaml index e6b9e3fec..533c4283b 100644 --- a/deploy/docker-compose/template/scheduler.template.yaml +++ b/deploy/docker-compose/template/scheduler.template.yaml @@ -180,7 +180,3 @@ console: false # Listen port for pprof, default is -1 (means disabled). pprofPort: -1 - -tracing: - # Jaeger endpoint url, like: http://jaeger.dragonfly.svc:4317. - addr: '' diff --git a/deploy/docker-compose/template/seed-client.template.yaml b/deploy/docker-compose/template/seed-client.template.yaml index d279c0f93..0946a9eb7 100644 --- a/deploy/docker-compose/template/seed-client.template.yaml +++ b/deploy/docker-compose/template/seed-client.template.yaml @@ -195,8 +195,3 @@ metrics: port: 4012 # # ip is the listen ip of the metrics server. # ip: "" - -# # tracing is the tracing configuration for dfdaemon. -# tracing: -# # addr is the address to report tracing log. -# addr: "" diff --git a/manager/config/config.go b/manager/config/config.go index 38b8d48b8..a81bec82f 100644 --- a/manager/config/config.go +++ b/manager/config/config.go @@ -408,6 +408,7 @@ func New() *Config { Console: false, PProfPort: -1, Tracing: base.TracingConfig{ + Path: "/v1/traces", ServiceName: types.ManagerName, }, }, diff --git a/scheduler/config/config.go b/scheduler/config/config.go index c3f614c35..87a84e409 100644 --- a/scheduler/config/config.go +++ b/scheduler/config/config.go @@ -323,6 +323,7 @@ func New() *Config { Console: false, PProfPort: -1, Tracing: base.TracingConfig{ + Path: "/v1/traces", ServiceName: types.SchedulerName, }, },