RuntimeTools / appmetrics

Node Application Metrics provides a foundational infrastructure for collecting resource and performance monitoring data for Node.js-based applications.
https://developer.ibm.com/open/node-application-metrics/
Apache License 2.0
971 stars 125 forks source link

metrics wont work if not using pg module directly #151

Open srkimir opened 8 years ago

srkimir commented 8 years ago

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/

tunniclm commented 8 years ago

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.

srkimir commented 8 years ago

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

seabaylea commented 8 years ago

@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.

srkimir commented 8 years ago

@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

seabaylea commented 8 years ago

Thanks - we'll take a look.

muhamed-didovic commented 8 years ago

+1

enko commented 7 years ago

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

sjanuary commented 7 years ago

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