Describe the bug
Under Node 18, on a system with ipv6 enabled, localhost resolves to ::1 (the ipv6 address) while under Node <= 16 it resolved to 127.0.0.1 (the ipv4 address). Considering that APM server listens on the ipv4 address only in these conditions if using the default configuration (as per elastic/apm-server#1405), upgrading an application using this agent from Node 16 to Node 18 (now that Node 18 is LTS) will prevent APM from working because the agent defaults serverUrl to http://localhost:8200.
To Reproduce
Upgrade an existing app using this agent to Node 18.
Expected behavior
APM keeps on working fine after the Node upgrade.
Environment (please complete the following information)
- OS: Ubuntu 22.04
- Node.js version: 18
- APM Server version: 8.5.1
- Agent version: Latest
How are you starting the agent? (please tick one of the boxes)
Additional context
Suggested fix: Default serverUrl to http://127.0.0.1:8200
Describe the bug
Under Node 18, on a system with ipv6 enabled,
localhostresolves to::1(the ipv6 address) while under Node <= 16 it resolved to127.0.0.1(the ipv4 address). Considering that APM server listens on the ipv4 address only in these conditions if using the default configuration (as per elastic/apm-server#1405), upgrading an application using this agent from Node 16 to Node 18 (now that Node 18 is LTS) will prevent APM from working because the agent defaultsserverUrltohttp://localhost:8200.To Reproduce
Upgrade an existing app using this agent to Node 18.
Expected behavior
APM keeps on working fine after the Node upgrade.
Environment (please complete the following information)
How are you starting the agent? (please tick one of the boxes)
agent.start()directly (e.g.require('elastic-apm-node').start(...))elastic-apm-node/startfrom within the source code-r elastic-apm-node/startAdditional context
Suggested fix: Default
serverUrltohttp://127.0.0.1:8200