Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid IPv4 vs IPv6 ambiguity in default 'serverUrl' by using '127.0.0.1' rather than 'localhost' #3049

Merged
merged 4 commits into from
Dec 8, 2022

Conversation

trentm
Copy link
Member

@trentm trentm commented Nov 28, 2022

Starting in node v17 the defaults for DNS resolution order was
changed (nodejs/node#39987) such that
dns.lookup() no longer sorted IPv4 addresses first. This impacts
usage of the default APM Server URL (the serverUrl config var),
'http://localhost:8200', when using node >=17 because the APM server
only binds to the IPv4 address by default
(elastic/apm-server#1405).

Fixes: #3045
Refs: elastic/apm#727


This is a start of the change. I've docs and the http-client, etc. to update. Also I'll follow up with an APM agents shared spac PR change.

Checklist

…7.0.0.1' rather than 'localhost'

Starting in node v17 the defaults for DNS resolution order was
changed (nodejs/node#39987) such that
`dns.lookup()` no longer sorted IPv4 addresses first. This impacts
usage of the *default* APM Server URL (the `serverUrl` config var),
'http://localhost:8200', when using node >=17 because the APM server
only binds to the IPv4 address by default
(elastic/apm-server#1405).

Fixes: #3045
@trentm trentm self-assigned this Nov 28, 2022
@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Nov 28, 2022
@apmmachine
Copy link
Contributor

apmmachine commented Nov 28, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-12-08T18:10:29.707+0000

  • Duration: 24 min 47 sec

Test stats 🧪

Test Results
Failed 0
Passed 319082
Skipped 0
Total 319082

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • run module tests for <modules> : Run TAV tests for one or more modules, where <modules> can be either a comma separated list of modules (e.g. memcached,redis) or the string literal ALL to test all modules

  • run benchmark tests : Run the benchmark test only.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

trentm added a commit to elastic/apm-nodejs-http-client that referenced this pull request Nov 28, 2022
…d IPv6 ambiguity

The APM agent won't *require* this change, because in the referenced
change it will be adding the same default on its end.

Refs: elastic/apm-agent-nodejs#3049
trentm added a commit to elastic/apm-nodejs-http-client that referenced this pull request Dec 8, 2022
…d IPv6 ambiguity (#190)

v11.0.4.
The APM agent won't *require* this change, because in the referenced
change it will be adding the same default on its end.

Refs: elastic/apm-agent-nodejs#3049
@trentm trentm marked this pull request as ready for review December 8, 2022 18:12
@trentm trentm merged commit a3c87e1 into main Dec 8, 2022
@trentm trentm deleted the trentm/default-apm-server-host-on-node18 branch December 8, 2022 20:00
v1v added a commit to v1v/apm-agent-nodejs that referenced this pull request Jan 16, 2023
…lemetry-actions

* upstream/main: (148 commits)
  chore(deps): bump jsonwebtoken and @azure/msal-node (elastic#3087)
  fix bitrot.js dev-util to work for Next.js versions (elastic#3086)
  synchronize json schema specs (elastic#3082)
  chore(deps): bump json5 from 1.0.1 to 1.0.2 (elastic#3085)
  synchronize json schema specs (elastic#3078)
  chore(deps-dev): bump fastify from 4.10.2 to 4.11.0 (elastic#3083)
  chore(deps): bump next (elastic#3081)
  docs: fix header name with sampled flag (elastic#3069)
  3.41.1 (elastic#3077)
  fix: span compression bug where a buffered span would not be sent when an incompressible sibling ended (elastic#3076)
  chore(deps-dev): bump wait-on from 6.0.1 to 7.0.1 (elastic#3075)
  chore(deps-dev): bump undici from 5.12.0 to 5.14.0 (elastic#3068)
  chore(deps-dev): bump got from 11.8.5 to 11.8.6 (elastic#3067)
  chore(deps-dev): bump koa from 2.13.4 to 2.14.1 (elastic#3066)
  chore(deps-dev): bump @hapi/hapi from 21.0.0 to 21.1.0 (elastic#3058)
  chore(deps-dev): bump @fastify/formbody from 7.3.0 to 7.4.0 (elastic#3057)
  3.41.0 (elastic#3064)
  Support publishing a snapshot build for each commit to main (elastic#3050)
  fix: Add `tracestate` to the `TransactionOptions` TypeScript type (elastic#3063)
  fix: avoid IPv4 vs IPv6 ambiguity in default 'serverUrl' by using '127.0.0.1' rather than 'localhost' (elastic#3049)
  ...
fpm-peter pushed a commit to fpm-git/apm-agent-nodejs that referenced this pull request Aug 20, 2024
…7.0.0.1' rather than 'localhost' (elastic#3049)

Starting in node v17 the defaults for DNS resolution order was
changed (nodejs/node#39987) such that
`dns.lookup()` no longer sorted IPv4 addresses first. This impacts
usage of the *default* APM Server URL (the `serverUrl` config var),
'http://localhost:8200', when using node >=17 because the APM server
only binds to the IPv4 address by default
(elastic/apm-server#1405).

Fixes: elastic#3045
Refs: elastic/apm#727
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-nodejs Make available for APM Agents project planning.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade an app to Node 18 breaks APM with the default configuration
2 participants