Skip to content

Commit

Permalink
fix(tracing): properly resolve when multiple trace agent url env vari…
Browse files Browse the repository at this point in the history
…ables are used (backport #3686) (#3689)

This is an automatic backport of pull request #3686 done by [Mergify](https://mergify.com).


---


<details>
<summary>Mergify commands and options</summary>

<br />

More conditions and actions can be found in the [documentation](https://docs.mergify.com/).

You can also trigger Mergify actions by commenting on this pull request:

- `@Mergifyio refresh` will re-evaluate the rules
- `@Mergifyio rebase` will rebase this PR on its base branch
- `@Mergifyio update` will merge the base branch into this PR
- `@Mergifyio backport <destination>` will backport this PR on `<destination>` branch

Additionally, on Mergify [dashboard](https://dashboard.mergify.com/) you can:

- look at your merge queues
- generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com
</details>
  • Loading branch information
mergify[bot] authored May 6, 2022
1 parent c5d3b54 commit 0a3dfd5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
7 changes: 0 additions & 7 deletions ddtrace/bootstrap/sitecustomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ def update_patched_modules():
try:
from ddtrace import tracer

dd_hostname = os.getenv("DD_TRACE_AGENT_HOSTNAME")
hostname = os.getenv("DD_AGENT_HOST", dd_hostname)
port = os.getenv("DD_TRACE_AGENT_PORT")
priority_sampling = os.getenv("DD_PRIORITY_SAMPLING")
profiling = asbool(os.getenv("DD_PROFILING_ENABLED", False))

Expand All @@ -100,10 +97,6 @@ def update_patched_modules():
trace_enabled = False
opts["enabled"] = False

if hostname:
opts["hostname"] = hostname
if port:
opts["port"] = int(port)
if priority_sampling:
opts["priority_sampling"] = asbool(priority_sampling)

Expand Down
2 changes: 1 addition & 1 deletion ddtrace/internal/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

def get_trace_hostname(default=DEFAULT_HOSTNAME):
# type: (Union[T, str]) -> Union[T, str]
return os.environ.get("DD_AGENT_HOST", os.environ.get("DATADOG_TRACE_AGENT_HOSTNAME", default))
return os.environ.get("DD_AGENT_HOST", os.environ.get("DD_TRACE_AGENT_HOSTNAME", default))


def get_stats_hostname(default=DEFAULT_HOSTNAME):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
fixes:
- |
tracing: fix issue with ``ddtrace-run`` having the wrong priority order of tracer host/port/url env variable configuration.

0 comments on commit 0a3dfd5

Please sign in to comment.