Skip to content

Commit 6b6db17

Browse files
authored
Properly handle trace agent IPv6 URL in profiling (#9339)
(cherry picked from commit ffa80b2)
1 parent 8777b20 commit 6b6db17

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

internal-api/src/main/java/datadog/trace/api/Config.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4742,7 +4742,7 @@ public String getFinalProfilingUrl() {
47424742
return "https://intake.profile." + site + "/api/v2/profile";
47434743
} else {
47444744
// when profilingUrl and agentless are not set we send to the dd trace agent running locally
4745-
return "http://" + agentHost + ":" + agentPort + "/profiling/v1/input";
4745+
return getAgentUrl() + "/profiling/v1/input";
47464746
}
47474747
}
47484748

internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,6 +1652,19 @@ class ConfigTest extends DDSpecification {
16521652
config.getFinalProfilingUrl() == "https://some.new.url/goes/here"
16531653
}
16541654

1655+
def "ipv6 profiling url"() {
1656+
setup:
1657+
def configuredUrl = "http://[2600:1f14:1cfc:5f07::38d4]:8126"
1658+
def props = new Properties()
1659+
props.setProperty(TRACE_AGENT_URL, configuredUrl)
1660+
1661+
when:
1662+
Config config = Config.get(props)
1663+
1664+
then:
1665+
config.getFinalProfilingUrl() == configuredUrl + "/profiling/v1/input"
1666+
}
1667+
16551668
def "fallback to DD_TAGS"() {
16561669
setup:
16571670
environmentVariables.set(DD_TAGS_ENV, "a:1,b:2,c:3")

0 commit comments

Comments
 (0)