Skip to content

Commit 1af7980

Browse files
committed
Ensure APM agent config file path respects CWD
1 parent 989a349 commit 1af7980

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/apm.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,13 @@ module.exports = function (serviceName = name) {
2525
if (process.env.kbnWorkerType === 'optmzr') return;
2626

2727
const conf = {
28-
serviceName: `${serviceName}-${version.replace(/\./g, '_')}`
28+
serviceName: `${serviceName}-${version.replace(/\./g, '_')}`,
2929
};
3030

31-
if (configFileExists()) conf.configFile = 'config/apm.js';
31+
const configFile = join(__dirname, '..', 'config', 'apm.js');
32+
33+
if (existsSync(configFile)) conf.configFile = configFile;
3234
else conf.active = false;
3335

3436
require('elastic-apm-node').start(conf);
3537
};
36-
37-
function configFileExists() {
38-
return existsSync(join(__dirname, '..', 'config', 'apm.js'));
39-
}

0 commit comments

Comments
 (0)