Guys, I'm trying to use APM in a NodeJS API I have, every environment is local using Docker.
The APM Server normally connects to the Kibana check, but the problem is that my Agent in this check returns the message "No data has been received from agents yet", even following the step-by-step that is informed.
If I skip the Agent part and click on Load Kibana objects, my service appears available, and the data starts to be obtained when performing some request, but it is not 100% functional, because when an error occurs, I don't have the stack tracing, between other things, how do I succeed in this connection?
Unfortunately, the current Elastic Node.js APM agent does not support automatically patching modules that use the import ... statement (ESM). There are two issues here:
First, the way import works, all modules are loaded in a phase before the code that imported those modules runs. That means that in your example, import apm from 'elastic-apm-node'; loads the APM agent module, and any imports lower down (e.g., import http from 'http') will load those modules before the apm.start(...) is executed.This APM agent document describes how to use import 'elastic-apm-node/start' to solve this issue. (However that doc is misleading in that it implies that ESM is then fully supported.)
The second issue is that currently the APM agent cannot hook into subsequent import statements, (e.g. import http from 'http'), so it is unable to do any automatic tracing. The APM agent's manual instrumentations still work, e.g. apm.startTransaction(...), but that is too limited.
Thank you for the answer, I even saw steps in the documentation for Babel/ES Module etc. I did them without success.
But I also tried to start a project from scratch, as attached in the last image I posted in the thread, with only JavaScript and 2 dependencies, which is express and apm-agent-nodejs itself, the code practically the same as copied in the documentation , but I keep having the same problem, it just returns "No data has been received from agents yet".
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.