New Relic Node.js agent code base. Developers are welcome to create pull requests here, please see our contributing guidelines. For New Relic technical support, please go to http://support.newrelic.com.
Apache License 2.0
967
stars
396
forks
source link
Add easier and generic instrumentation on Sequelize models #2613
Is your feature request related to a problem? Please describe.
I want to instrument db queries via the Sequelize model executed so that it can give an idea which queries are slow.
As of now I see a generic instrumentation implementation for a datastore and also a all in one example of sequelize which is equivalent to a web transaction metrics
Feature Description
It would be really helpful if theres a pluggable implementation to instrument sequelize models as per the query time being taken and it would be great if its pluggable on the model level instead of instrumenting on query execution level .
Describe Alternatives
As of now I dont have a real example to show . But just to demonstrate
static associate(models) {
this.belongsTo(models.Asset, {
foreignKey: 'assetId', // 'assetId' is a column in 'Post' referencing 'id' in 'Asset'
as: 'asset', // Optional: Specifies an alias for when you load the association
});
this.hasMany(models.Comment, {
foreignKey: 'postId',
as: 'comments',
});
}
}
Post.instrument(shim){
// add instrumentation
}`
Additional context
Add any other context here.
Priority
Please help us better understand this feature request by choosing a priority from the following options:
Really want to track during load testing
Is your feature request related to a problem? Please describe.
I want to instrument db queries via the Sequelize model executed so that it can give an idea which queries are slow. As of now I see a generic instrumentation implementation for a datastore and also a all in one example of sequelize which is equivalent to a web transaction metrics
Feature Description
It would be really helpful if theres a pluggable implementation to instrument sequelize models as per the query time being taken and it would be great if its pluggable on the model level instead of instrumenting on query execution level .
Describe Alternatives
As of now I dont have a real example to show . But just to demonstrate
`class Post extends Model { static init(sequelize) { super.init( { userId:DataTypes.INTEGER, assetId:DataTypes.INTEGER }, { sequelize, timestamps: true, underscored: false, createdAt: "createdAt", updatedAt: "updatedAt", tableName: "posts", } ); }
}
Post.instrument(shim){ // add instrumentation }`
Additional context
Add any other context here.
Priority
Please help us better understand this feature request by choosing a priority from the following options: Really want to track during load testing