openzipkin / zipkin-go

Zipkin distributed tracing library for go.
Apache License 2.0
612 stars 114 forks source link

HTTPReporter: Adds b3:0 header and unit test for custom headers using HTTPDoer #176

Closed basvanbeek closed 4 years ago

basvanbeek commented 4 years ago

To mitigate trace amplification in service mesh environments we default to sending a B3: 0 header to our outgoing OOB calls to the Zipkin collector.

To allow these calls still to be traced by a sidecar, this now default behavior can be reverted using the AllowSamplingReporterCalls functional option.

There is sometimes a need to inject custom headers as well. We had the support through the HTTPDoer interface but did not test for this functionality to work. This PR adds a unit test for it as well as show how to use HTTPDoer for this feature.

coveralls commented 4 years ago

Coverage Status

Coverage increased (+13.3%) to 74.407% when pulling a4c38a5ce1fe8bd78612eb3b89eeaef4a066ceb1 on basvanbeek:http-reporter-sampled-0 into dc18516bbb4c951b5b61a7940d688f13173b0bff on openzipkin:master.

codefromthecrypt commented 4 years ago

https://github.com/openzipkin/b3-propagation/pull/42

jcchavezs commented 4 years ago

I am wonder if we should be supporting the option AllowSamplingReporterCalls for not including B3 header. Brave does not and frankly I'd not support the option until someone really wants to trace the reporting call. What do you think @basvanbeek?