Skip to content

contrib/net/http: make roundTripper propagation (inject, extract) optional#1224

Merged
katiehockman merged 10 commits into
DataDog:mainfrom
rangelrealecb:roundtripper-propagation
Jun 29, 2023
Merged

contrib/net/http: make roundTripper propagation (inject, extract) optional#1224
katiehockman merged 10 commits into
DataDog:mainfrom
rangelrealecb:roundtripper-propagation

Conversation

@rangelrealecb

Copy link
Copy Markdown
Contributor

I need to make an http call to a vendor, and I would like to trace this call (and its parameters), but using the current roundTripper would "leak" the trace_id / parent_id as headers, as they are inject automatically on the call.

I propose adding an option (true by default):

func RTWithPropagation(propagation bool) RoundTripperOption {
	return func(cfg *roundTripperConfig) {
		cfg.propagation = propagation
	}
}

and check this before injecting

        if rt.cfg.propagation {
	    err = tracer.Inject(span.Context(), tracer.HTTPHeadersCarrier(req.Header))
            ...
        }

Fixes #1166

@rangelrealecb
rangelrealecb requested a review from a team March 29, 2022 12:30
@ajgajg1134 ajgajg1134 added this to the 1.39.0 milestone Apr 27, 2022

@ajgajg1134 ajgajg1134 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for submitting a change! Overall this is looking good just one change requested :)

Comment thread contrib/net/http/option.go
@Hellzy Hellzy modified the milestones: 1.39.0, 1.40.0 Jul 1, 2022
@Hellzy Hellzy modified the milestones: 1.40.0, 1.41.0 Jul 15, 2022
@Hellzy Hellzy modified the milestones: 1.41.0, 1.42.0 Aug 16, 2022
@knusbaum knusbaum modified the milestones: 1.42.0, 1.43.0 Sep 19, 2022
@Julio-Guerra Julio-Guerra modified the milestones: 1.43.0, v1.44.0 Oct 18, 2022
@ajgajg1134 ajgajg1134 modified the milestones: v1.44.0, v1.45.0 Nov 21, 2022
@Julio-Guerra Julio-Guerra modified the milestones: v1.45.0, Triage Dec 13, 2022
@katiehockman katiehockman self-assigned this Jun 29, 2023
katiehockman
katiehockman previously approved these changes Jun 29, 2023
@katiehockman
katiehockman requested review from ajgajg1134 and removed request for ajgajg1134 June 29, 2023 15:32
ajgajg1134
ajgajg1134 previously approved these changes Jun 29, 2023
@katiehockman
katiehockman dismissed stale reviews from ajgajg1134 and themself via 8790307 June 29, 2023 15:58
@katiehockman
katiehockman merged commit 43a3523 into DataDog:main Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

proposal: contrib/net/http: make roundTripper propagation (inject, extract) optional

6 participants