Skip to content

Commit 55a5233

Browse files
authored
feat: add headers for tracing (#4129)
Signed-off-by: Gaius <gaius.qi@gmail.com>
1 parent 75bd3c2 commit 55a5233

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

cmd/dependency/base/option.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ type TracingConfig struct {
2929
Addr string `yaml:"addr" mapstructure:"addr"`
3030
// ServiceName is the name of the service for tracing.
3131
ServiceName string `yaml:"service-name" mapstructure:"service-name"`
32+
// Headers are additional headers to be sent with tracing requests.
33+
Headers map[string]string `yaml:"headers" mapstructure:"headers"`
3234
}

cmd/dependency/dependency.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func initJaegerTracer(ctx context.Context, tracingConfig base.TracingConfig) (fu
150150
return nil, fmt.Errorf("could not create gRPC connection to collector: %w", err)
151151
}
152152

153-
exporter, err := otlptracegrpc.New(ctx, otlptracegrpc.WithGRPCConn(conn))
153+
exporter, err := otlptracegrpc.New(ctx, otlptracegrpc.WithGRPCConn(conn), otlptracegrpc.WithHeaders(tracingConfig.Headers))
154154
if err != nil {
155155
return nil, fmt.Errorf("could not create trace exporter: %w", err)
156156
}

0 commit comments

Comments
 (0)