appmetrics
appmetrics copied to clipboard
metrics wont work if not using pg module directly
For example i'm using sequelize http://docs.sequelizejs.com/ which is ORM for PostgreSQL which behind the scenes use pg
module. Following wont work with ORM but will work if using pg
directly:
var appmetrics = require('appmetrics');
var monitoring = appmetrics.monitor();
metrics.on('postgres', (data) => {
console.log(data)
})
Same thing happens for mongo and mongoose ODM http://mongoosejs.com/
This may not be the problem, but (as far as I remember) you need to require('appmetrics')
before requiring any module you want it to monitor.
Putting require('appmetrics')
before anything didn't solve the problem. I don't know if this question can be categorised as problem but probably package should work together with most popular ORMs/ODMs
@srkimir Is there a dependency between sequelize
and pg
? I can't find an obvious one via either the sequelize page on npmjs.com or looking at the packages installed via npm install sequelize
If there isn't, we could always look at adding support for sequelize
monitoring.
@seabaylea From http://docs.sequelizejs.com/en/latest/docs/getting-started/ (check Installation part), if one is using PostgreSQL with sequelize npm install --save pg
is required
Thanks - we'll take a look.
+1
The same happens if you use pg
via loopback, respectively loopback-connector-postgresql
.
See #152 for why appmetrics doesn't work with Mongoose