Hello,
I'm ind of new with Elastic APM, Starting working with it this week. I'm working with elastic-apm-node package, nodejs and express.
Package-version:"elastic-apm-node": "^1.12.0"
Code:
const apm = require('elastic-apm-node');
apm.start({
serverUrl: 'http://apm_server_hostname:apm_server_port',
logLevel: 'debug',
});
The main issue I'm having is that APM is not being able to create the span in the current transaction.
APM Log example:
adding hook to Node.js module loader
shimming express@4.16.3 module
shimming express.Router.process_params function
shimming express.Router.use function
shimming express.static function
copying property mime from express.static
shimming http@9.11.2 module
shimming http.Server.prototype.emit function
shimming http.request function
shimming http.ServerResponse.prototype.writeHead function
shimming https@9.11.2 module
shimming https.Server.prototype.emit function
shimming https.request function
shimming layer.handle_request function (layer: router)
skip shimming layer.handle_request (layer: jsonParser, path: /)
skip shimming layer.handle_request (layer: , path: /)
skip shimming layer.handle_request (layer: router, path: /)
skip shimming layer.handle_request (layer: errorMiddleware, path: /)
intercepted request event call to http.Server.prototype.emit
setting transaction result { id: 'a60cf357-64fb-412e-a4b3-fbadb9516525',
result: 'success' }
start transaction { id: 'a60cf357-64fb-412e-a4b3-fbadb9516525',
name: undefined,
type: undefined }
shimming express.Router.Layer.handle function
shimming express.Router.Layer.handle function
shimming express.Router.Layer.handle function
shimming express.Router.Layer.handle function
shimming express.Router.Layer.handle function
shimming express.Router.Layer.handle function
shimming express.Router.Layer.handle function
no active transaction found - cannot build new span
intercepted call to https.request { id: null }
[2018-09-11 13:13:56.482] [INFO] Service call to settings profiler // call to another service
type: http_service_profiler
service: endpoint
durationMs: 8025
duration: 8025ms
setting transaction result { id: 'a60cf357-64fb-412e-a4b3-fbadb9516525',
result: 'HTTP 2xx' }
[2018-09-11 13:13:56.492] [INFO] GET /endpoint/general 200 8035ms
res:
statusCode: 200
req:
url: /endpoint/general
headers:
host: localhost:3000
user-agent: curl/7.47.0
accept: /
method: GET
httpVersion: 1.1
originalUrl: /endpoint/general
query: {}
responseTime: 8035
message_id: 89ccadb0-b5c4-11e8-9594-5f11febf4442
setting default transaction name: GET /endpoint/general { id: 'a60cf357-64fb-412e-a4b3-fbadb9516525' }
adding transaction to queue { id: 'a60cf357-64fb-412e-a4b3-fbadb9516525' }
setting timer to flush queue: 5208ms
ended transaction { id: 'a60cf357-64fb-412e-a4b3-fbadb9516525',
type: 'request',
result: 'HTTP 2xx',
name: 'GET /endpoint/general' }
flushing queue
sending transactions payload
no active transaction found - cannot build new span
intercepted call to http.request { id: null }
I'll be glad if somebody already implemented this with node and solved this issue.
Thanks
Gerardo