Hi @Frank_Corona. Thanks for the question.
From that configuration file, my guess is that the elastic-apm-node agent will be started too late. By the time bootstrap()
calls require('elastic-apm-node').start()
all of the above import ...
s will already have run -- including, I'm guessing, importing the http
module. That often (but not always) means that elastic-apm-node will not be able to instrument the http
(and other modules) before your application code gets a handle on an uninstrumented version. When your application later uses the http module, it will possibly be using the uninstrumented version.
Is the main initiation file / startup code for your "scratch service" different?
Starting the agent | APM Node.js Agent Reference [4.x] | Elastic describes one way you could try to avoid this issue, and ensure that the APM agent is started before your other import
s execute. That documentation page describes the various ways you can start the APM agent and also has some sections describing some common surprises.