-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for mysql connection pools. #119
Comments
Hi there, Thanks for checking out our Node.js agent! We do support connection pooling and would love to get more info about what you are seeing. Would you mind submitting a ticket through http://support.newrelic.com with more details? We are especially interested in:
Thanks! |
Hi, in instrumentation newrelic is only wrapping the createConnection method. We never use this. Instead we use PoolCluster.getConnection. No mysql data is seen if we use Pool or PoolCluster in node-mysql. Wrapping this is not trivial. Pool internally uses the constructor directly though a event is raised so the we can wrap the connection when listening to |
Hi @atishay811, I had a look through node-mysql and you're absolutely right, using We can definitely look at including this feature in an upcoming release. I will leave this issue open, but you may also want to submit a support ticket to help prioritize your feature request. If not, I'll also keep this issue updated to let you know when it appears on our roadmap. |
@groundwater I'd rather prefer all Pool* to call createConnection internally - please post your suggestions to node-mysql I'm also interested to see what do I need to add to node-mysql2 for newrelic support |
node-mysql also supports events. Unluckily, even that implementation is incomplete. Pool has an event for a new connection created but PoolCluster does not forward that event. Nor does it have an event for Pool created. The add calls to the cluster could be wrapped but that isn't a neat solution. Meanwhile for others that come to this thread, I have a workaround. I do not use the raw createConnection call and have a PoolCluster present. At the startup before requiring newrelic, I create our poolcluster and modify the createConnection. poolCluster = mysql.createPoolCluster();
pool.add("READ", {...});
var connection = null;
mysql.createConnection = function () {
return connection;
};
poolCluster._nodes.READ.pool.on("connection", function (newConnection) {
connection = newConnection;
mysql.createConnection();
}); This approach is very fragile and will break with changes to newrelic or mysql, but is good enough to get working for now. |
plus one for added pool support to the agent! |
Still no solution, node-mysql has been updated the events are more consitent for pools this should be easy to fix. I have been waiting for months! |
Easy to fix is relative. Instrumentation isn't the most simple problem due to how the call stack gets sliced up when you do something async. That said, +1 on these public issues don't translate very well to affecting our roadmap. Which is part of the reason we are in the process of phasing them out. Please contact support via https://support.newrelic.com/ so we can better serve you and track your request. |
…/messaging-app/word-wrap-1.2.4 chore(deps-dev): bump word-wrap from 1.2.3 to 1.2.4 in /messaging-app
Release v7.0.1
Drops support for Node 12.
Release v4.1.0
Release v4.1.0
Release v0.5.0
The newrelic module doesn't seems to support node-mysql 2.0.0's connection pool and pool clusters.
The text was updated successfully, but these errors were encountered: