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

we are not using gcp/aws/azure and apm is trying to make a metadata request to them #4459

Closed
sibelius opened this issue Feb 10, 2025 · 1 comment

Comments

@sibelius
Copy link
Contributor

is this the default behavior ? can we disable this ?

HTTP 514907: SOCKET ERROR: socket connection to metadata token server timed out Error: socket connection to metadata token server timed out
at ClientRequest.<anonymous> (app/node_modules/elastic-apm-node/lib/cloud-metadata/aws.js:138:7)
at ClientRequest.emit (node:events:524:28)
at Timeout.onConnectTimeout [as _onTimeout] (app/node_modules/elastic-apm-node/lib/http-request.js:137:13)
at listOnTimeout (node:internal/timers:594:17)
at process.processTimers (node:internal/timers:529:7)
HTTP 514907: SOCKET ERROR: could not ping azure metadata server Error: could not ping azure metadata server
at ClientRequest.<anonymous> (app/node_modules/elastic-apm-node/lib/cloud-metadata/azure.js:72:17)
at ClientRequest.emit (node:events:524:28)
at Timeout.onConnectTimeout [as _onTimeout] (app/node_modules/elastic-apm-node/lib/http-request.js:137:13)
at listOnTimeout (node:internal/timers:594:17)
at process.processTimers (node:internal/timers:529:7)
@trentm
Copy link
Member

trentm commented Feb 10, 2025

It is the default behaviour to attempt to reach the local metadata endpoints on startup to gather that information. It is meant to only log at the debug-level and below if one is not running inside any of those cloud providers (Azure, AWS, GCP). For example when using an example script from the apm-agent-nodejs.git repo:

$ ELASTIC_LOG_LEVEL=trace node examples/trace-http.js
...
{"log.level":"debug","@timestamp":"2025-02-10T16:01:12.889Z","log.logger":"elastic-apm-node","ecs.version":"8.10.0","message":"no cloud metadata servers responded"}
{"log.level":"trace","@timestamp":"2025-02-10T16:01:12.889Z","log.logger":"elastic-apm-node","ecs.version":"8.10.0","event.module":"apmclient","message":"getCloudMetadata err: Error: no response from any callback, no cloud metadata will be set (normal outside of cloud env.)"}
...

The error that you are seeing is different than what I've seen before, so there is possibly an issue for us to deal with here.

disable this

If you know you aren't running your services in one of these environments and/or do not care about having cloud metadata associated with your tracing data, then you can disable this via the cloudProvider: 'none' config setting (or ELASTIC_APM_CLOUD_PROVIDER=none env var):

https://www.elastic.co/guide/en/apm/agent/nodejs/current/configuration.html#cloud-provider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants