appmetrics icon indicating copy to clipboard operation
appmetrics copied to clipboard

metrics wont work if not using pg module directly

Open srkimir opened this issue 9 years ago • 8 comments

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/

srkimir avatar Feb 15 '16 09:02 srkimir

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.

tunniclm avatar Feb 15 '16 09:02 tunniclm

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 avatar Feb 15 '16 09:02 srkimir

@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 avatar Feb 15 '16 09:02 seabaylea

@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

srkimir avatar Feb 15 '16 09:02 srkimir

Thanks - we'll take a look.

seabaylea avatar Feb 15 '16 10:02 seabaylea

+1

muhamed-didovic avatar Feb 15 '16 10:02 muhamed-didovic

The same happens if you use pg via loopback, respectively loopback-connector-postgresql.

enko avatar Oct 24 '16 11:10 enko

See #152 for why appmetrics doesn't work with Mongoose

sjanuary avatar Apr 25 '17 12:04 sjanuary