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

Feature request: Add support for captureMySQL #749

Open
cortexcompiler opened this issue Apr 8, 2022 · 3 comments
Open

Feature request: Add support for captureMySQL #749

cortexcompiler opened this issue Apr 8, 2022 · 3 comments
Labels
feature-request This item refers to a feature request for an existing or new utility need-customer-feedback Requires more customers feedback before making or revisiting a decision on-hold This item is on-hold and will be revisited in the future revisit-in-3-months Blocked issues/PRs that need to be revisited tracer This item relates to the Tracer Utility

Comments

@cortexcompiler
Copy link

Description of the feature request

Add captureMySQL support to the Tracer or add it to the ProviderServiceInterface

Problem statement

As a user I would like to trace MySQL queries leveraging the powertools Tracer.

Summary of the feature

I appreciate the encapsulation of X-Ray that is enabled through Tracer and would like to use it more fully. Rather than using captureMySQL from aws-xray-sdk-mysql, I would prefer to do one of the following (in order of preference):

  1. Automatically Trace MySQL calls, either by default or enabled with a setting, similar to tracing-http-requests
  2. Manually trace MySQL calls by wrapping the library with a tracer.captureMySQL(mysqlLib) similar to patching-aws-sdk-clients
  3. Leverage the escape hatch mechanism to access the tracer.provider.captureMySQL() as is eluded to in the escape-hatch-mechanism that refers to SQL queries tracing

Code examples
Current approach

// current approach 1
const AWSXRay = require('aws-xray-sdk');
const mysql = AWSXRay.captureMySQL(require('mysql'));

// current approach 2
const captureMySQL = require('aws-xray-sdk-mysql');
captureMySQL(require('mysql2'));

Options

import { Tracer } from '@aws-lambda-powertools/tracer';
const tracer = new Tracer({ serviceName: 'myService' });

// Option 1 - automatic
const mysql = require('mysql');

// Option 2 - similar to patching AWS SDK
const mysql2 = tracer.captureMySQL(require('mysql'));

// Option 3 - escape hatch
const mysql3 = tracer.provider.captureMySQL(require('mysql'));

Benefits for you and the wider AWS community
Uniformly using the powertools Tracer abstraction rather than directly using X-Ray. This would allow users to benefit from the continued improvements added to the powertools without the need to modify tracing code.

Describe alternatives you've considered
Continue to use the x-ray sdk directly.

Additional context

Related issues, RFCs

@cortexcompiler cortexcompiler added the triage This item has not been triaged by a maintainer, please wait label Apr 8, 2022
@dreamorosi
Copy link
Contributor

Hi @cortexcompiler, thank you for the feature request.

At the moment Tracer depends only on aws-xray-sdk-core, this choice was made to keep dependencies and deployment size low.

The X-Ray SDK also vends separately aws-xray-sdk-postgres and aws-xray-sdk-mysql, with the latter being the one needed to unlock the use case you suggest.

Since not every customer will be querying Mysql nor Postgres with their functions I would like to explore the possibility of Tracer supporting these features without having to include these dependencies in the library. Ideally this would mean that customers interested in tracing these types of operations would be able to add the extra dependency and pass either their own provider (option 1 that you suggest) or the captureMySQL function only when instantiating the Tracer.

This type of mechanism requires a bit of thought so we'll need a bit of time to investigate options and consider the feature request.

We are currently focused on bringing the current feature set to general availability and production ready worthiness. After this is done we'll re evaluate this (and other feature requests) to decide our next steps based on demand.

@dreamorosi dreamorosi added on-hold This item is on-hold and will be revisited in the future RFC Technical design documents related to a feature request tracer This item relates to the Tracer Utility labels Apr 14, 2022
@dreamorosi dreamorosi changed the title feat(tracer): Add support for captureMySQL Feature (tracer): Add support for captureMySQL May 12, 2022
@dreamorosi dreamorosi added need-customer-feedback Requires more customers feedback before making or revisiting a decision and removed triage This item has not been triaged by a maintainer, please wait RFC Technical design documents related to a feature request labels Nov 13, 2022
@dreamorosi dreamorosi added feature-request This item refers to a feature request for an existing or new utility and removed enhancement labels Nov 13, 2022
@dreamorosi dreamorosi changed the title Feature (tracer): Add support for captureMySQL Feature request: Add support for captureMySQL Nov 14, 2022
@kaykhan
Copy link

kaykhan commented Feb 7, 2024

Hi we are also interested in this feature - #2027

@dreamorosi
Copy link
Contributor

Hi everyone - just wanted to provide a quick update on this issue.

I see that the issue is getting some traction in terms of engagement. For the remainder of this year the team is focused on other areas, but we are evaluating making changes to how the Tracer utility works internally next year - so this topic might be included into that discussion.

We'll revisit this issue in a few months to see if anything has changed or provide updates.

@dreamorosi dreamorosi added the revisit-in-3-months Blocked issues/PRs that need to be revisited label Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request This item refers to a feature request for an existing or new utility need-customer-feedback Requires more customers feedback before making or revisiting a decision on-hold This item is on-hold and will be revisited in the future revisit-in-3-months Blocked issues/PRs that need to be revisited tracer This item relates to the Tracer Utility
Projects
Development

No branches or pull requests

3 participants