diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/option.go b/instrumentation/github.com/Shopify/sarama/otelsarama/option.go index 1369f3daf0e..bda57e74028 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/option.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/option.go @@ -72,6 +72,8 @@ func WithTracerProvider(provider trace.TracerProvider) Option { // ones will be used. func WithPropagators(propagators propagation.TextMapPropagator) Option { return optionFunc(func(cfg *config) { - cfg.Propagators = propagators + if propagators != nil { + cfg.Propagators = propagators + } }) } diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/option_test.go b/instrumentation/github.com/Shopify/sarama/otelsarama/option_test.go index 88f85687cb3..84ce5636d56 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/option_test.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/option_test.go @@ -49,7 +49,7 @@ func TestNewConfig(t *testing.T) { expected: config{ TracerProvider: otel.GetTracerProvider(), Tracer: otel.GetTracerProvider().Tracer(defaultTracerName, trace.WithInstrumentationVersion(contrib.SemVersion())), - Propagators: nil, + Propagators: otel.GetTextMapPropagator(), }, }, } diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/config.go b/instrumentation/github.com/astaxie/beego/otelbeego/config.go index 2b9b7bd9b8d..2f3e4e41cce 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/config.go +++ b/instrumentation/github.com/astaxie/beego/otelbeego/config.go @@ -68,7 +68,9 @@ func WithMeterProvider(provider metric.MeterProvider) Option { // Defaults to global.Propagators(). func WithPropagators(propagators propagation.TextMapPropagator) Option { return optionFunc(func(c *config) { - c.propagators = propagators + if propagators != nil { + c.propagators = propagators + } }) } diff --git a/instrumentation/github.com/emicklei/go-restful/otelrestful/config.go b/instrumentation/github.com/emicklei/go-restful/otelrestful/config.go index 43596832491..8546f360659 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/config.go +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/config.go @@ -41,7 +41,9 @@ func (o optionFunc) apply(c *config) { // ones will be used. func WithPropagators(propagators propagation.TextMapPropagator) Option { return optionFunc(func(cfg *config) { - cfg.Propagators = propagators + if propagators != nil { + cfg.Propagators = propagators + } }) } diff --git a/instrumentation/github.com/gin-gonic/gin/otelgin/option.go b/instrumentation/github.com/gin-gonic/gin/otelgin/option.go index bdc02247876..d625bea6e54 100644 --- a/instrumentation/github.com/gin-gonic/gin/otelgin/option.go +++ b/instrumentation/github.com/gin-gonic/gin/otelgin/option.go @@ -42,7 +42,9 @@ func (o optionFunc) apply(c *config) { // ones will be used. func WithPropagators(propagators propagation.TextMapPropagator) Option { return optionFunc(func(cfg *config) { - cfg.Propagators = propagators + if propagators != nil { + cfg.Propagators = propagators + } }) } diff --git a/instrumentation/github.com/gorilla/mux/otelmux/config.go b/instrumentation/github.com/gorilla/mux/otelmux/config.go index f9c00d7563e..9d9c691d741 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/config.go +++ b/instrumentation/github.com/gorilla/mux/otelmux/config.go @@ -41,7 +41,9 @@ func (o optionFunc) apply(c *config) { // ones will be used. func WithPropagators(propagators propagation.TextMapPropagator) Option { return optionFunc(func(cfg *config) { - cfg.Propagators = propagators + if propagators != nil { + cfg.Propagators = propagators + } }) } diff --git a/instrumentation/github.com/labstack/echo/otelecho/config.go b/instrumentation/github.com/labstack/echo/otelecho/config.go index ca2ea087204..43d1b5df1f3 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/config.go +++ b/instrumentation/github.com/labstack/echo/otelecho/config.go @@ -44,7 +44,9 @@ func (o optionFunc) apply(c *config) { // ones will be used. func WithPropagators(propagators propagation.TextMapPropagator) Option { return optionFunc(func(cfg *config) { - cfg.Propagators = propagators + if propagators != nil { + cfg.Propagators = propagators + } }) } diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/grpctrace.go b/instrumentation/google.golang.org/grpc/otelgrpc/grpctrace.go index 0cf98ced0d7..5b93c02aceb 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/grpctrace.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/grpctrace.go @@ -59,7 +59,9 @@ func newConfig(opts []Option) *config { type propagatorsOption struct{ p propagation.TextMapPropagator } func (o propagatorsOption) apply(c *config) { - c.Propagators = o.p + if o.p != nil { + c.Propagators = o.p + } } // WithPropagators returns an Option to use the Propagators when extracting diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/config.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/config.go index 44b01c56c1a..80f4e0bc044 100644 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/config.go +++ b/instrumentation/gopkg.in/macaron.v1/otelmacaron/config.go @@ -46,7 +46,9 @@ func newConfig(opts []Option) *config { type propagatorsOption struct{ p propagation.TextMapPropagator } func (o propagatorsOption) apply(c *config) { - c.Propagators = o.p + if o.p != nil { + c.Propagators = o.p + } } // WithPropagators returns an Option to use the Propagators when extracting diff --git a/instrumentation/net/http/httptrace/otelhttptrace/httptrace.go b/instrumentation/net/http/httptrace/otelhttptrace/httptrace.go index 14dfe3c57a6..283a1a396f3 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/httptrace.go +++ b/instrumentation/net/http/httptrace/otelhttptrace/httptrace.go @@ -53,7 +53,9 @@ func newConfig(opts []Option) *config { // WithPropagators sets the propagators to use for Extraction and Injection func WithPropagators(props propagation.TextMapPropagator) Option { return optionFunc(func(c *config) { - c.propagators = props + if props != nil { + c.propagators = props + } }) } diff --git a/instrumentation/net/http/otelhttp/config.go b/instrumentation/net/http/otelhttp/config.go index b89b8e1f864..8190f3ca244 100644 --- a/instrumentation/net/http/otelhttp/config.go +++ b/instrumentation/net/http/otelhttp/config.go @@ -108,7 +108,9 @@ func WithPublicEndpoint() Option { // option isn't specified, then the global TextMapPropagator is used. func WithPropagators(ps propagation.TextMapPropagator) Option { return optionFunc(func(c *config) { - c.Propagators = ps + if ps != nil { + c.Propagators = ps + } }) }