hello.
I want to use Elastic APM to ingest transactions from my application into Kibana.
I have used APM Server and Elastic Search with ECK.
And I wrote the code like below.
const apm = require('elastic-apm-node');
// Initialize Elastic APM
apm.start({
serviceName: 'nodejsservice',
serverUrl: 'MYSERVER',
secretToken: "MYTOKEN",
logLevel: "trace",
captureBody: 'all',
transactionSampleRate: 1.0
});
const express = require('express');
// Create an Express app
const app = express();
// Define a route
app.get('/', (req, res) => {
res.send('Hello, World!');
});
// Start the server
const port = 3000;
app.listen(port, () => {
console.log(`Server is running on port ${port}`);w
});
When I accessed localhost:3000/ here, I expected to see a transaction captured for this request and visible in the APM tab in Kibana, but I don't see any transactions. However, I am continuously collecting metrics like CPU and Memory, which are visible in the APM tab.
They also don't appear to be collected in the trace index in Elasticsearch.
How can we resolve this?
- Errors are well tracked. However, normal transactions are not tracked at all.
You can custom create and send a transaction via the code below, which will create a transaction. However, I expect basic HTTP transactions to be auto-instrumented without doing this.
var trans = apm.startTransaction('GET /', 'request');
trans.end()