Couchbase+Node js+Elasticsearch APM, Couchbase bucket.get operation destroys current APM transaction

Hi,

We are using couchbase+node+elasticsearch APM in our application. We are using Elasticsearch APM to monitor our processes. We have custom node js stack so we are using APM as provided on this link APM. So for each HTTP transaction APM creates new transaction automatically to log the data for that transaction. But whenever i use Bucket.get function of couchbase SDK, APM loses the current transaction info. I’ve checked with all other databases (redis,mysql,n1ql quries) but none of them breaks the APM transaction. only bucket.get operation kill the object. I think it is the issue with SDK, I am adding the example. I am skipping steps like APM transaction, connection creation because it’s working proper with other db calls.

Working:

let apm = require('elastic-apm-node');

function get(request, response) {


  console.log((apm.currentTransaction));// logs transaction info

  setTimeout(()=>{
    console.log(apm.currentTransaction);// logs transaction info
    return response.sendJson({},200);
  },2000)

}

Not Working

let apm = require('elastic-apm-node');

cluster = new couchbase.Cluster();

cluster.authenticate("Administrator", "root@123");

bucket = cluster.openBucket('conf');

function get(request, response) {

  console.log((apm.currentTransaction));// logs transaction info

  bucket.get("ABC",(err,resp)=>{

    console.log(resp) // correctly prints document data

    console.log((apm.currentTransaction));//<<<<<<<<< this prints 'null'

  return response.sendJson(resp, 500);

 })

}

Please look into the issue. please let me know if you need more information on this
Thanks

Hey @akashpatel.iitp,
I have a reasonably good idea what may be causing this. I’m going to do some investigating and I’ll try to get back to you as soon as possible. In the meantime, you can track this issue here: https://issues.couchbase.com/browse/JSCBC-533 .

Cheers, Brett

1 Like

hey, @brett19

Thanks a lot.