we are developing node.js app (in k8s), logs stored in ELK Stack 8.3.3
in attempt to configure APM with Node.js Agent (elastic-apm-node - npm)
get error
APM Server transport error (ECONNRESET): socket hang up
we are developing node.js app (in k8s), logs stored in ELK Stack 8.3.3
in attempt to configure APM with Node.js Agent (elastic-apm-node - npm)
get error
APM Server transport error (ECONNRESET): socket hang up
Hello @kvaga,
The "APM Server transport error (ECONNRESET): socket hang up" error message is the Node.js APM agent saying that APM server ended a connection while the APM agent was trying to talk to it. In earlier versions of the agent (before this issue was resolved) this could happen occasionally due to a race in TCP-keepalive handling.
What version of the APM agent are you using?
Do you get this "APM Server transport error" everytime the APM agent starts? Or is it an error that only happens occasionally?
Are you able to get some "trace"-level log output from the APM agent and show that here? You can turn on trace-level logging by adding logLevel: 'trace'
to the apm.start({...})
method, or by setting the ELASTIC_APM_LOG_LEVEL=trace
environment variable.
That looks like it is every ~30s, which is about how often the APM agent will attempt to send metrics to the APM server. So it seems likely that every attempt the APM agent makes to talk to the configured serverUrl
results in the APM server unexpectedly closing the connection.
The APM agent logs from logLevel: 'trace'
will show a little bit more detail.
Your serverUrl
uses http:
rather than https:
. Is that expected for your setup? Also you are using Basic auth (pmap-logs:$password@
) in your serverUrl
. Do you have a proxy in front of your APM server that is handling that authentication? My experience is with using a secretToken
or apiKey
with APM server for auth. See Secure communication with APM agents | APM User Guide [8.11] | Elastic and Configuration options | APM Node.js Agent Reference [4.x] | Elastic
after correcting https to http, i see metrisc cpu & memory, but it`s not transactions, errors...
logs from elastic-apm-node
Okay, good that data (metrics) is getting from the APM agent to APM server.
About getting other tracing data (transactions, spans, errors) report:
Automatic instrumentation of NestJS is not currently supported by the Node.js APM agent. So it is possible that there is a limitation here. I'm am not familiar enough with NestJS to know if we should expect some raw HTTP instrumentation to work. There is an issue here that requests official NestJS instrumentation: When will the nest.js plugin be supported. · Issue #1836 · elastic/apm-agent-nodejs · GitHub
The first thing to try adjusting is to try to make sure that the APM agent is started before your other modules are imported. One thing to try is to change your import apm ...
and apm.start()
to:
import 'elastic-apm-node/start'; // put this before any other imports
// ...
and then use environment variables or an "elastic-apm-node.js" config module to configure the APM agent. Another technique is to have a separate "initapm.ts" module as described at Starting the agent | APM Node.js Agent Reference [3.x] | Elastic
(This doc section describes some surprises with TypeScript and getting the APM agent to start first: Starting the agent | APM Node.js Agent Reference [3.x] | Elastic)
OK a see
оn DEV - OK
we add same connection to APM ELK ( + add enviroment: production)
i see, metrics for CPU/mem
but there is no transaction
how to add data from apm about transaction ... etc
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.