Elastic APM does not collect transactions

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()

From Elastic Observability to APM

Hi @marload,

Welcome to the community! Can you share which versions of the Elastic APM Node.js agent and Express that you are using? Can you also confirm you don't see any errors in the application logs originating from APM?

@marload That should be working as you are expecting. When I attempt to run your example code, it is working for me and the APM agent is sending transactions (and metrics) correctly.

You have "logLevel": "trace" enabled. Are you able to send us the log output from the APM agent (elastic-apm-node) so we can try to see if the logs explain the issue?