Agent is running before the start function is called.
See original GitHub issueDescribe the bug I have a customised start function (example has been simplified)
'use strict';
const apm = require('elastic-apm-node');
const start = () => {
if (process.env.ELASTIC_APM_ACTIVE !== 'false') {
apm.start();
}
return apm;
};
module.exports = { start };
I use kubernetes and from what I understand all environment variables have to be strings and should be converted in the app if you want it in a different format (boolean etc).
To get around this I specifically check for process.env.ELASTIC_APM_ACTIVE !== 'false'
and don’t call the start method.
The problem is even though the start method isn’t called, apm will still log an error to the server.
logging error 3a397735-9dde-4f45-9b5e-212e88197336 with Elastic APM
To Reproduce Steps to reproduce the behavior:
- Create a file that returns APM.
- Require the file, but don’t call the start method.
- Throw an error, it should be logged to the APM server.
Expected behavior
The agent should not start and a log Elastic APM agent is inactive due to configuration
should appear during start up.
Environment (please complete the following information)
- OS: Alpine 3.4
- Node.js version: v6.11.0
- APM Server version: 🤷♂️ current cloud version
- Agent version: 1.8.2
How are you starting the agent? (please tick one of the boxes)
- Calling
agent.start()
directly (e.g.require('elastic-apm-node').start(...)
) - Requiring
elastic-apm-node/start
from within the source code - Starting node with
-r elastic-apm-node/start
Additional context Add any other context about the problem here.
-
Agent config options
Click to expand
replace this line with your agent config options
-
package.json
dependencies:Click to expand
"elastic-apm-node": "1.8.2",
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (6 by maintainers)
Top GitHub Comments
FYI: In the new version of the agent this was simplified/changed so that you now just have to set
ELASTIC_APM_LOG_LEVEL=trace
in order to log the debug output that we need.Closing for now due to lack of activity. If it should be reopened, just leave a comment 😃