Skip to content
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 tracing requests in X-Ray SDK for Node.js with sequelize and mysql2 #275

Closed
eistrati opened this issue Apr 9, 2020 · 4 comments
Assignees

Comments

@eistrati
Copy link

eistrati commented Apr 9, 2020

We have tried and failed to replicate the workaround for sequelize and mysql2, similar to the one provided for sequelize and postgresql described in this issue: #271

Can you please help with providing support for sequelize and mysql2? Any workarounds available as of today?

@willarmiros
Copy link
Contributor

Hi @eistrati,
Thanks for raising this issue. At the moment this SDK does not support automatic tracing of the mysql2 library, we only support mysql and postgres. We are always open to pull requests.

As a workaround, you can manually create a subsegment around your mysql2 query and add your sqlData yourself. See this documentation for a list of whitelisted fields in the sql field of subsegments.

const sqlObj = {
  database_type: 'MySQL',
  database_version: '1.0.0'
};

var sub = AWSXRay.getSegment().addNewSubsegment('mysql2');

// Make query

sub.addSqlData(sqlObj);
sub.close();

@eistrati
Copy link
Author

@willarmiros thank you! any thoughts and/or timelines on when mysql2 will be supported? as of today, it looks much more performant than mysql one. we'll try it with my team and see if the workaround solves our current needs (at least temporarily). thanks again! your input is very much appreciated.

@willarmiros
Copy link
Contributor

Unfortunately we cannot provide timelines for future features. It is in our backlog however and I will update this issue once it gets prioritized.

@willarmiros
Copy link
Contributor

Apologies! I did not realize that there was in fact an issue already open to support mysql2 and we do indeed provide partial support for it! In #6 some other customers appear to have implemented partial support for mysql2, particularly the query() and execute() methods. Note that you'll need to have 3.0.0-alpha.2 installed to support async/await capturing.

Although there appear to be some issues with pool.execute(). Furthermore, this support & caveats for mysql2 should be documented, which I'll add shortly. The following should provide the partial support described in #6:

var mysql2 = AWSXRay.captureMySQL(require('mysql2'));

I'll be closing this as a duplicate of #6 (and #271 for sequelize). Please follow up over there with any issues you experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants