cloud-trace-nodejs
cloud-trace-nodejs copied to clipboard
Enhanced database reporting for mongoose not working
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.
-
Is this a client library issue or a product issue? Client library
-
Did someone already solve this? No
-
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!
@bcoe any news on that ? Is there anything I can do to help you with that?
@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.
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.
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.
Closing this out - people who need improved Mongoose telemetry should consider using OTel instead.