propose: contrib/net/http: add conditional propagation logic to roundTripper configuration #2823
Open
Description
I want to determine whether to propagate or not for each api I call.
For example, when calling a external api, no propagation is performed.
I assume the following code.
// https://github.com/DataDog/dd-trace-go/blob/e4985df5f9ef6a5b1f5cc9f72b03ddddcb4af0bc/contrib/net/http/option.go#L138
type roundTripperConfig struct {
// ...
+ propagationFunc func(*http.Request) bool
// ...
}
func (rt *roundTripper) RoundTrip(req *http.Request) (res *http.Response, err error) {
// ...
// https://github.com/DataDog/dd-trace-go/blob/e4985df5f9ef6a5b1f5cc9f72b03ddddcb4af0bc/contrib/net/http/roundtripper.go#L73
- if rt.cfg.propagation {
+ if rt.cfg.propagation && rt.cfg.propagationFunc(r2) {