Skip to content

Commit

Permalink
Revert "explicitly set agent statdsport when needed"
Browse files Browse the repository at this point in the history
This reverts commit da55abe.
  • Loading branch information
hannahkm committed Oct 16, 2024
1 parent da55abe commit baba093
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions ddtrace/tracer/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,23 +525,16 @@ func newConfig(opts ...StartOption) *config {
// no config defined address; use defaults
addr = defaultDogstatsdAddr()
}
if agentport := c.agent.StatsdPort; agentport > 0 {
if agentport := c.agent.StatsdPort; agentport > 0 && !c.agent.ignore {
// the agent reported a non-standard port
host, port, err := net.SplitHostPort(addr)
host, _, err := net.SplitHostPort(addr)
if err == nil {
// we have a valid host:port address; replace the port because
// the agent knows better
if host == "" {
host = defaultHostname
}
if !c.agent.ignore {
port = strconv.Itoa(agentport)
}
addr = net.JoinHostPort(host, port)
p, err := strconv.Atoi(port)
if err != nil {
c.agent.StatsdPort = p
}
addr = net.JoinHostPort(host, strconv.Itoa(agentport))
}
// not a valid TCP address, leave it as it is (could be a socket connection)
}
Expand Down

0 comments on commit baba093

Please sign in to comment.