cloud-trace-nodejs icon indicating copy to clipboard operation
cloud-trace-nodejs copied to clipboard

Enhanced database reporting for mongoose not working

Open VikramTiwari opened this issue 3 years ago • 4 comments

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

  1. Is this a client library issue or a product issue? Client library

  2. Did someone already solve this? No

  3. Do you have a support contract? No

Environment details

  • OS: macos and debian
  • Node.js version: 14.17.0
  • npm version: 6.14.13
  • @google-cloud/trace-agent version: 5.1.5

Steps to reproduce

Since I don't see an open issue about mongoose tracking, I am assuming this is something to do with my setup.

  • data-models: internal npm package that contains all mongoose schema and methods
  • API: where this package is imported and mongoose schema and methods are utilized

Sample:

async function getAdmins(req, res, next) {
  try {
    const admins = await User.find({level: `admin`})
    return res.status(200).json({
      admins,
    })
  } catch (error) {
    next(error)
  }
}
router.get(`/admins`, getAdmins)

Here the User is coming from the data-models package. I can see the request trace in cloud trace but I don't see database spans along with the API.

Tracer config:

const traceConfig = {
  samplingRate: 5,
  enhancedDatabaseReporting: true,
  ignoreMethods: [`OPTIONS`],
  ignoreUrls: [`^/$`],
  flushDelaySeconds: 1
}
const tracer = require(`@google-cloud/trace-agent`).start(traceConfig)

Any reason this setup might not work as expected?

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

VikramTiwari avatar Sep 02 '21 19:09 VikramTiwari

@bcoe any news on that ? Is there anything I can do to help you with that?

gilles-yvetot avatar Nov 01 '21 18:11 gilles-yvetot

@gilles-yvetot unfortunately we don't currently have someone working on this bug. We make a best effort to address bugs within 180 days, so I'm hopeful this will be fixed in the not too distant future.

bcoe avatar Nov 08 '21 16:11 bcoe

Hi @VikramTiwari, which version of mongoose are you using? Unfortunately only mongoose versions 4 - 5 are supported and version 6 is not supported. Support for version 6 is tracked by https://github.com/googleapis/cloud-trace-nodejs/issues/1401.

gkf avatar Dec 07 '21 15:12 gkf

Hey @gkf We were using mongoose v4 and it wasn't working. Since then we have migrated to mongoose v6 and we are now using open telemetry for capturing and pushing to cloud trace. Sorry about not being able to help here anymore.

VikramTiwari avatar Dec 07 '21 18:12 VikramTiwari

Closing this out - people who need improved Mongoose telemetry should consider using OTel instead.

punya avatar Aug 16 '22 18:08 punya