From cafe654b1a01cf0b2210e83d209bdf9b6081402e Mon Sep 17 00:00:00 2001 From: Ian Milligan Date: Wed, 13 May 2020 16:43:01 -0700 Subject: [PATCH] Add HTTP Tracecontext propagation to delivery client provider --- cmd/broker/fanout/wire_gen.go | 2 +- cmd/broker/retry/wire_gen.go | 2 +- pkg/broker/handler/pool/providers.go | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/broker/fanout/wire_gen.go b/cmd/broker/fanout/wire_gen.go index 3278c2a9fb..31540be210 100644 --- a/cmd/broker/fanout/wire_gen.go +++ b/cmd/broker/fanout/wire_gen.go @@ -45,6 +45,6 @@ func InitializeSyncPool(ctx context.Context, projectID pool.ProjectID, targetsVo } var ( - _wireValue = []http.Option(nil) + _wireValue = pool.DefaultHTTPOpts _wireValue2 = pool.DefaultCEClientOpts ) diff --git a/cmd/broker/retry/wire_gen.go b/cmd/broker/retry/wire_gen.go index d5763fb0cf..8cb3e85926 100644 --- a/cmd/broker/retry/wire_gen.go +++ b/cmd/broker/retry/wire_gen.go @@ -41,6 +41,6 @@ func InitializeSyncPool(ctx context.Context, projectID pool.ProjectID, targetsVo } var ( - _wireValue = []http.Option(nil) + _wireValue = pool.DefaultHTTPOpts _wireValue2 = pool.DefaultCEClientOpts ) diff --git a/pkg/broker/handler/pool/providers.go b/pkg/broker/handler/pool/providers.go index 9852b6e816..be3211e8fe 100644 --- a/pkg/broker/handler/pool/providers.go +++ b/pkg/broker/handler/pool/providers.go @@ -24,6 +24,8 @@ import ( cehttp "github.com/cloudevents/sdk-go/v2/protocol/http" cepubsub "github.com/cloudevents/sdk-go/v2/protocol/pubsub" "github.com/google/wire" + "go.opencensus.io/plugin/ochttp" + "go.opencensus.io/plugin/ochttp/propagation/tracecontext" ) var ( @@ -33,6 +35,10 @@ var ( ceclient.WithTracePropagation(), } + DefaultHTTPOpts = []cehttp.Option{ + cehttp.WithRoundTripper(&ochttp.Transport{Propagation: &tracecontext.HTTPFormat{}}), + } + // ProviderSet provides the fanout and retry sync pools using the default client options. In // order to inject either pool, ProjectID, []Option, and config.ReadOnlyTargets must be // externally provided. @@ -43,7 +49,7 @@ var ( NewDeliverClient, NewPubsubClient, NewRetryClient, - wire.Value([]cehttp.Option(nil)), + wire.Value(DefaultHTTPOpts), wire.Value(DefaultCEClientOpts), ) )