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: honor WithHeaderTags in WrapHandler #2288

Merged
merged 2 commits into from
Oct 30, 2023

Conversation

sudolibre
Copy link
Contributor

What does this PR do?

Header tags configuration was only being handled in ServeHTTP but not in WrapHandler. This adds the logic to handle header tags in WrapHandler as well.

Motivation

This allows leveraging WithHeaderTags when using WrapHandler

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.

For Datadog employees:

  • If this PR touches code that handles credentials of any kind, such as Datadog API keys, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.

Unsure? Have a question? Request a review!

Header tags configuration was only being handled in ServeHTTP but not in WrapHandler. This adds the logic to handle header tags in WrapHandler as well.
@sudolibre sudolibre requested a review from a team October 23, 2023 19:45
@@ -85,8 +85,9 @@ func WrapHandler(h http.Handler, service, resource string, opts ...Option) http.
if r := cfg.resourceNamer(req); r != "" {
resc = r
}
so := make([]ddtrace.StartSpanOption, len(cfg.spanOpts))
so := make([]ddtrace.StartSpanOption, len(cfg.spanOpts), len(cfg.spanOpts)+1)
Copy link
Contributor Author

@sudolibre sudolibre Oct 23, 2023

Choose a reason for hiding this comment

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

This change essentially duplicates line 56-59 in ServeHTTP

@darccio
Copy link
Contributor

darccio commented Oct 30, 2023

I ran all tests in #2307. Good to go.

@darccio darccio merged commit aaa56d8 into DataDog:main Oct 30, 2023
10 of 11 checks passed
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.

None yet

2 participants