Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Tracer in Transport #45

Closed

Conversation

shaxbee
Copy link

@shaxbee shaxbee commented May 15, 2019

Add Tracer argument to nethttp.Transport.
Fixes #29

@shaxbee
Copy link
Author

shaxbee commented May 15, 2019

Hold on merging, there is sp state in Tracer, need to fix this to avoid race condition.

@shaxbee
Copy link
Author

shaxbee commented May 16, 2019

Fixed and ready for review.

I would suggest small refactoring of Tracer clientOptions - instead making them public structure with simple public fields, as there is unnecessary overhead of applying functional options on each call plus it cannot be used without dedicated constructor. Let me know if i can make those changes.

@yurishkuro
Copy link
Collaborator

it would be a breaking change. Rather than refactoring it would have to be differently named constructor function

@shaxbee
Copy link
Author

shaxbee commented May 17, 2019

Alright, would current change be acceptable then?

@yurishkuro
Copy link
Collaborator

What happens to the root span created in start() function if the user does not call finish()?

	req, ht := nethttp.TraceRequest(tracer, req)
	defer ht.Finish()

Also, the PR needs unit test for the new mode and update to the docs showing the alternative usage.

@wpjunior
Copy link
Contributor

@shaxbee and @yurishkuro I had wrote a wrapper to put tracer inside the transport at tsuru.io.

You could see the code here: https://github.com/tsuru/tsuru/blob/main/net/opentracing.go#L29

I hope that will help to achieve this solution.

@yurishkuro
Copy link
Collaborator

closing old/stale PR

@yurishkuro yurishkuro closed this Sep 23, 2021
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.

RoundTripper should work out of the box.
3 participants