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

Set PeerHostname/PeerPort rather than URL based on connection. #3

Closed
wants to merge 1 commit into from

Conversation

robholland
Copy link

if port, err := strconv.Atoi(portString); err != nil {
ext.PeerPort.Set(h.sp, uint16(port))
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

actually, I think both of these are wrong. The url and peer tags should be set for all traced http requests (i.e. in RoundTrip method), not only those for which httptrace.ClientTrace is enabled. What should really happen here is:

h.sp.LogKV(log.String("event", "GetConn"), log.String("hostPort", hostPort))

(or split host/port into two k/v pairs if not lazy).

I don't know how much more overhead httptrace.ClientTrace adds, it would be nice to make it optional. The RoundTrip is really what's needed for the actual tracing/propagation.

Copy link
Author

Choose a reason for hiding this comment

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

I don't see a way to get the actual peer hostname from the request context, only via the GotConn callback.

Copy link
Collaborator

Choose a reason for hiding this comment

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

net.URL#Host

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.

2 participants