Kibana version: 8.5.3
Elasticsearch version: 8.5.3
APM Server version: 8.5.3
APM Agent language and version: Node Js 3.41.0
Browser version: FIrefox
Original install method (e.g. download page, yum, deb, from source, etc.) and version: deb
Fresh install or upgraded from other version? Fresh install
Is there anything special in your setup? No
Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):
We have worked with version 3.31.0 of the agent for node js, this version works fine, when we update to the latest version we now have a duplicate record of the last sql (mysql) operation executed inside a function, when we add a span in the function.
If we don't add the span in the function, it works fine, but when we add the span it generates the duplicate, this doesn't happen in version 3.31.0.
We tried remove version 3.41.0 and then install version 3.31.0 again and it works fine
Code Steps to reproduce:
// Add this to the VERY top of the first file loaded in your app
const apm = require('elastic-apm-node').start({
// Override service name from package.json
// Allowed characters: a-z, A-Z, 0-9, -, _, and space
serviceName: 'EXPRESS2',
// Set custom APM Server URL (default: http://127.0.0.1:8200)
serverUrl: 'http://192.168.XX,XX:8200',
})
async function consulta_1(data)
{
//Creamos el Span
const span = apm.startSpan('Procedure.subcuentavehiculos',"funcion","m_test","custom",{ exitSpan: false })
sql = `SELECT privileges FROM gs_users WHERE id =${data.id}`
resultado = await consulta(sql)
// Finalizamos el Span
if (span) span.end()
}
async function inicio()
{
let obj ={"host":"192.168.xx.xx","user":"xxxxxxx","password":"xxxxxxx","database":"xxxxxxx","dateStrings":true,"multipleStatements": true}
/*Conexion Mysql */
resultado = await require('./middleware/database')( obj )
console.log(resultado)
const app = require('express')()
app.get('/', async function (req, res) {
await consulta_1({"user_id":"7","id":32})
res.send('Hello World!')
})
app.listen(3020)
}
inicio()