Skip to content

Commit a3d32f9

Browse files
authored
Properly handle trace agent IPv6 URL in profiling (#9334)
1 parent 707dc91 commit a3d32f9

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
@@ -4746,7 +4746,7 @@ public String getFinalProfilingUrl() {
47464746
return "https://intake.profile." + site + "/api/v2/profile";
47474747
} else {
47484748
// when profilingUrl and agentless are not set we send to the dd trace agent running locally
4749-
return "http://" + agentHost + ":" + agentPort + "/profiling/v1/input";
4749+
return getAgentUrl() + "/profiling/v1/input";
47504750
}
47514751
}
47524752

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)