Apm-agent doesn't sending transactions

I'm trying to analyse a query made to a sql server through the tedious driver, in the apm server on kibana i can see the errors and the metrics, but i can't see any transactions, I'm running the apm agent in the top of a node js application. Please tell me if i am doing something wrong. Here is my apm agent configuration:

var apm = require('elastic-apm-node').start({
    serviceName: 'sqlserver',
    serverUrl: 'xxx:8200'
})

var Connection = require('tedious').Connection;

var config = {
    server : "myserver",
    authentication: {
        type: "default",
        options: {
            userName: 'sa',
            password: 'mypass',
        }
    },
    options: {
        database: 'myDb'
    }
};

    var connection = new Connection(config);

    connection.on('connect', function (err) {
        console.log("Connected");
        executeStatement();
    }
);

var Request = require('tedious').Request;

function executeStatement() {
    request = new Request("select * from mytable", function (err, rowCount) {
        if (err) {
            console.log(err);
        } else {
            console.log(rowCount + ' rows');
        }
    });

    request.on('row', function (columns) {
        columns.forEach(function (column) {
            console.log(column.value);
        });
    });

    connection.execSql(request);
}

Is the application exiting right after the query finishes?

If so, you need to use agent.flush(callback) to flush the internal data to the APM Server.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.