Skip to content

Add support for httptrace.ClientTrace on wrapped http.Client requests #1598

Open

Description

The standard library offers support for tracing details of the HTTP(s) connection state on requests via the httptrace.ClientTrace structure.

I have implemented this in our service code such that the http.request span includes the additional tags, for example:

image

Each of the numbers shown is the number of milliseconds consumed by a segment of the request cycle. I found it useful to discover the location of slow network connection establishment issues (spoiler: it was TLS not DNS that time!), verify the TLS cipher suites in use, and ascertain that connection pooling was working as expected.

My implementation is an http.RoundTripper wrapper that sets up the trace context and annotates the current span. I was thinking it would be a useful addition to contrib/net/http.

It could either be default behaviour (the overhead isn't high IMO), or it could be a RoundTripperOption to WrapClient.

I'm happy to contribute a PR for this feature, I'm looking for some confirmation it would be a welcome addition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    apm:ecosystemcontrib/* related feature requests or bugsenhancementquick change/addition that does not need full team approvalproposalmore in depth change that requires full team approvalproposal/acceptedAccepted proposals

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions