You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Transactions are not recorded for service but we can see the metrics
When we see the overview of the service we cannot see any data for that service but the name and entry is been added to the kibana UI. also I can see the metrics of that service. I want to trace the transactions for the service but it is not logged.
constexpress=require('express')constapp=express()// Add this to the VERY top of the first file loaded in your appvarapm=require('elastic-apm-node').start({// Override the service name from package.json// Allowed characters: a-z, A-Z, 0-9, -, _, and spaceserviceName: 'test-nodejs-app',// Use if APM Server requires a secret tokensecretToken: '',// Set the custom APM Server URL (default: http://localhost:8200)serverUrl: 'http://apm-server.com:8200',capture_body: 'all',// Set the service environmentenvironment: 'test'})app.get('/',(req,res)=>res.send('Hello World!'))app.listen(3000,()=>console.log('Server ready'))
The issue here is that you are starting the APM agent after Express has already been loaded. For the APM agent to be able to instrument the express module, it needs to be started before require('express'). So if you change your script to something like this, it should work:
// Add this to the VERY top of the first file loaded in your appvarapm=require('elastic-apm-node').start({serviceName: 'test-nodejs-app',secretToken: '',serverUrl: 'http://apm-server.com:8200',capture_body: 'all',environment: 'test'})constexpress=require('express')constapp=express()app.get('/',(req,res)=>res.send('Hello World!'))app.listen(3000,()=>console.log('Server ready'))
Hi Team,
Transactions are not recorded for service but we can see the metrics
When we see the overview of the service we cannot see any data for that service but the name and entry is been added to the kibana UI. also I can see the metrics of that service. I want to trace the transactions for the service but it is not logged.
Steps to reproduce the behavior:
Expected behavior
It should show the transaction when I hit on http://localhost:3000
Environment
How are you starting the agent? (please tick one of the boxes)
agent.start()
directly (e.g.require('elastic-apm-node').start(...)
)package.json
dependencies:Thanks & Regards
Pawan Gupta
The text was updated successfully, but these errors were encountered: