Ok, here are my tests results, code is the next one:
const express = require('express');
const app = express();
app.get('/', (req, res, next) => {
return res.send('Hello!');
});
app.listen(3000, () => console.log('Server up in port 3000'));
Installed libs:
express@4.17.1
elastic-apm-node@2.11.6
App output:
agent configured correctly { pid: 26687,
ppid: 22454,
arch: 'x64',
platform: 'darwin',
node: 'v8.12.0',
agent: '2.11.6',
ancestors:
[ '/Users/juanstiza/dev/hunt/apm-test/node_modules/elastic-apm-node/index.js',
'/Users/juanstiza/dev/hunt/apm-test/node_modules/elastic-apm-node/start.js',
null,
[length]: 3 ],
startTrace:
[ 'at Agent.start (/Users/juanstiza/dev/hunt/apm-test/node_modules/elastic-apm-node/lib/agent.js:149:11)',
'at Object.<anonymous> (/Users/juanstiza/dev/hunt/apm-test/node_modules/elastic-apm-node/start.js:3:32)',
'at Module._compile (module.js:653:30)',
'at Object.Module._extensions..js (module.js:664:10)',
'at Module.load (module.js:566:32)',
'at tryModuleLoad (module.js:506:12)',
'at Function.Module._load (module.js:498:3)',
'at Module.require (module.js:597:17)',
'at Function.Module._preloadModules (module.js:754:12)',
'at preloadModules (bootstrap_node.js:488:38)',
[length]: 10 ],
main: undefined,
dependencies: undefined,
conf:
{ verifyServerCert: true,
active: true,
logLevel: 'trace',
apiRequestSize: 786432,
apiRequestTime: 10,
stackTraceLimit: 50,
captureExceptions: true,
filterHttpHeaders: true,
captureErrorLogStackTraces: 'messages',
captureSpanStackTraces: true,
captureBody: 'off',
errorOnAbortedRequests: false,
abortedErrorThreshold: 25,
instrument: true,
asyncHooks: true,
sourceLinesErrorAppFrames: 5,
sourceLinesErrorLibraryFrames: 5,
sourceLinesSpanAppFrames: 0,
sourceLinesSpanLibraryFrames: 0,
errorMessageMaxLength: 2048,
transactionMaxSpans: 500,
transactionSampleRate: 1,
serverTimeout: 30,
disableInstrumentations: [ [length]: 0 ],
containerId: undefined,
kubernetesNodeName: undefined,
kubernetesNamespace: undefined,
kubernetesPodName: undefined,
kubernetesPodUID: undefined,
captureHeaders: true,
metricsInterval: 30,
usePathAsTransactionName: false,
addPatch: undefined,
globalLabels: undefined,
serviceName: 'hunt-mock-service',
secretToken: '{{SecretToken}}',
serverUrl: '{{ServerUrl}}',
logger:
{ trace:
{ [Function: log]
[length]: 0,
[name]: 'log',
[prototype]: log { [constructor]: [Circular] } },
debug:
{ [Function: log]
[length]: 0,
[name]: 'log',
[prototype]: log { [constructor]: [Circular] } },
info:
{ [Function: log]
[length]: 0,
[name]: 'log',
[prototype]: log { [constructor]: [Circular] } },
warn:
{ [Function: log]
[length]: 0,
[name]: 'log',
[prototype]: log { [constructor]: [Circular] } },
error:
{ [Function: log]
[length]: 0,
[name]: 'log',
[prototype]: log { [constructor]: [Circular] } },
fatal:
{ [Function: log]
[length]: 0,
[name]: 'log',
[prototype]: log { [constructor]: [Circular] } } },
ignoreUrlStr: [ [length]: 0 ],
ignoreUrlRegExp: [ [length]: 0 ],
ignoreUserAgentStr: [ [length]: 0 ],
ignoreUserAgentRegExp: [ [length]: 0 ],
transport:
{ [Function: httpTransport]
[length]: 2,
[name]: 'httpTransport',
[prototype]: httpTransport { [constructor]: [Circular] } },
serverHost: '{{ServerUrl}}',
serverPort: 443 } }
adding hook to Node.js module loader
shimming finalhandler@1.1.2 module
shimming http@8.12.0 module
shimming http.Server.prototype.emit function
shimming http.request function
shimming http.get function
shimming http.ServerResponse.prototype.writeHead function
shimming express@4.17.1 module
shimming express.Router.use function
shimming express.static function
copying property mime from express.static
shimming express.Router.Layer.handle function: query
shimming express.Router.Layer.handle function: expressInit
shimming express.Router.Layer.handle function: bound dispatch
Server up in port 3000
no active transaction found - cannot build new span
intercepted call to http.request { id: null }
intercepted request event call to http.Server.prototype.emit
start trace { trans: '58d24bca9fa7679b',
parent: undefined,
trace: 'c3f7fbba0d7a07a17cde4e56c1f2d4b1',
name: null,
type: null }
no original function off to wrap
no original function off to wrap
setting transaction result { trans: '58d24bca9fa7679b',
parent: undefined,
trace: 'c3f7fbba0d7a07a17cde4e56c1f2d4b1',
result: 'HTTP 2xx' }
setting default transaction name: GET / { trans: '58d24bca9fa7679b',
parent: undefined,
trace: 'c3f7fbba0d7a07a17cde4e56c1f2d4b1' }
sending transaction { trans: '58d24bca9fa7679b',
trace: 'c3f7fbba0d7a07a17cde4e56c1f2d4b1' }
ended transaction { trans: '58d24bca9fa7679b',
parent: undefined,
trace: 'c3f7fbba0d7a07a17cde4e56c1f2d4b1',
type: 'request',
result: 'HTTP 2xx',
name: 'GET /' }
no active transaction found - cannot build new span
intercepted call to http.request { id: null }
no active transaction found - cannot build new span
intercepted call to http.request { id: null }
no active transaction found - cannot build new span
intercepted call to http.request { id: null }
Start script: ELASTIC_APM_LOG_LEVEL=trace ELASTIC_APM_SERVICE_NAME=hunt-mock-service ELASTIC_APM_SECRET_TOKEN={{SecretToken}} ELASTIC_APM_SERVER_URL={{ServerUrl}} node -r elastic-apm-node/start index.js
Still no dice.
I tried setting the agent directly on the code:
require('elastic-apm-node').start({
secretToken: '{{SecretToken}}',
serverUrl: '{{ServerUrl}}',
serviceName: 'hunt-mock-service'
});
const express = require('express');
const app = express();
app.get('/', (req, res, next) => {
return res.send('Hello!');
});
app.listen(3000, () => console.log('Server up in port 3000'));
Same results.