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

contrib/net/http: Add new option to RoundTripper to ignore outgoing request #1398

Closed
a2ikm opened this issue Jul 27, 2022 · 2 comments · Fixed by #1403
Closed

contrib/net/http: Add new option to RoundTripper to ignore outgoing request #1398

a2ikm opened this issue Jul 27, 2022 · 2 comments · Fixed by #1403

Comments

@a2ikm
Copy link

a2ikm commented Jul 27, 2022

Overview

Please add a new option to RoundTripper in contrib/net/http to determine if an outgoing request tracing should be skipped.
This option should work like the following:

import (
    "net/http"
    httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http"
)

opt := httptrace.RTWithIgnoreRequest(func(r *http.Request) bool {
    return r.URL.Path == "/ping"
})

client := httptrace.WrapClient(&http.Client{}, opt)

It is like WithIgnoreRequest for ServeMux.

Background

I run a frontend server and a backend service. Both of them have endpoints for healthcheck to manage their container liveness. The frontend's one replies the response from the backend's one as is.
These endpoints are called very frequently. So I want to disable tracing on them so as not to fill up the tracing log screen.

I can disable incoming tracing with WithIgnoreRequest, but can't outgoing tracing now.

@a2ikm a2ikm changed the title contrib/net/http: Add new option to RoundTripper to ignore request contrib/net/http: Add new option to RoundTripper to ignore outgoing request Jul 27, 2022
@dianashevchenko
Copy link
Contributor

@a2ikm thanks for reaching out 🙌 I will open a PR shortly

@a2ikm
Copy link
Author

a2ikm commented Aug 4, 2022

Thank you!

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 a pull request may close this issue.

2 participants