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

fix(options): Don't override c.httpClient if it is set via the options #2970

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

BaptisteFoy
Copy link
Contributor

What does this PR do?

Prevents overrides to c.httpClient if it has been set by customers; even if the agent URL points to a unix socket

Motivation

For my software to work I had to update the HTTP client of my tracer. Using the latest agent and tracer and letting other settings as default, the HTTP client override didn't work.

This is because:

  1. Newer agent creates the socket by default ([APM] Add a default UDS listeners for traces and stats datadog-agent#26969)
  2. As the documentation states, if the socket file exists and no env var is set, the socket will be used as the agent URL
  3. If the socket is used as the agent URL, we override c.httpClient regardless of whether it has been previously set

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • 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.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

@BaptisteFoy BaptisteFoy requested a review from a team as a code owner November 7, 2024 17:11
@mtoffl01 mtoffl01 self-assigned this Nov 7, 2024
@pr-commenter
Copy link

pr-commenter bot commented Nov 7, 2024

Benchmarks

Benchmark execution time: 2024-11-07 17:54:20

Comparing candidate commit 466bf66 in PR branch baptiste.foy/dont-override-clients with baseline commit bebced4 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 59 metrics, 0 unstable metrics.

Copy link
Contributor

@mtoffl01 mtoffl01 left a comment

Choose a reason for hiding this comment

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

Great catch!

@mtoffl01 mtoffl01 merged commit 714ca72 into main Nov 7, 2024
150 checks passed
@mtoffl01 mtoffl01 deleted the baptiste.foy/dont-override-clients branch November 7, 2024 20:43
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