Skip to content

Maintenance: mark captureAWS and captureAWSClient methods as deprecated in Tracer #2397

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

Closed
1 of 2 tasks
dreamorosi opened this issue Apr 18, 2024 · 3 comments · Fixed by #2508
Closed
1 of 2 tasks
Assignees
Labels
confirmed The scope is clear, ready for implementation good-first-issue Something that is suitable for those who want to start contributing help-wanted We would really appreciate some support from community for this one tracer This item relates to the Tracer Utility

Comments

@dreamorosi
Copy link
Contributor

Summary

In March 2024, AWS announced that AWS SDK for JavaScript v2 will reach end-of-support in September 8, 2025. Additionally, the SDK has added warning logs to communicate the deprecation and encourage a migration to the newer AWS SDK for JavaScript v3.

In response to this announcement we should mark the Tracer methods used to instrument clients for this version, so that

Why is this needed?

So that Powertools customers relying on this feature have ample time to migrate from the method to and use the alternative captureAWSv3Client.

Which area does this relate to?

Tracer

Solution

Add a @deprecated notice on the methods found .

For example:

/**
 * Patch all AWS SDK v2 clients and create traces when your application makes calls to AWS services.
 *
 * If you want to patch a specific client use {@link captureAWSClient} and if you are using AWS SDK v3 use {@link captureAWSv3Client} instead.
 *
 * @see https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-nodejs-awssdkclients.html
 *
 * @example
 * ```typescript
 * import { Tracer } from '@aws-lambda-powertools/tracer';
 *
 * const tracer = new Tracer({ serviceName: 'serverlessAirline' });
 * const AWS = tracer.captureAWS(require('aws-sdk'));
 *
 * export const handler = async (_event: unknown, _context: unknown) => {
 *   ...
 * }
 * ```
 *
+ * @deprecated Use {@link captureAWSv3Client} instead.
 *
 * @param aws - AWS SDK v2 import
 * @returns AWS - Instrumented AWS SDK
 */
 public captureAWS<T>(aws: T): T {
   if (!this.isTracingEnabled()) return aws;

   return this.provider.captureAWS(aws);
 }

Additionally, we should also do the same and mark the ones here and here, like this:

 /**
 * Patch all AWS SDK v2 clients and create traces when your application makes calls to AWS services.
 *
+ * @deprecated
 *
 * @param awssdk - AWS SDK v2
 */
  public captureAWS<T>(awssdk: T): T {
   return captureAWS(awssdk);
 }

Acknowledgment

Future readers

Please react with 👍 and your use case to help us understand customer demand.

@dreamorosi dreamorosi added good-first-issue Something that is suitable for those who want to start contributing help-wanted We would really appreciate some support from community for this one tracer This item relates to the Tracer Utility confirmed The scope is clear, ready for implementation labels Apr 18, 2024
@dreamorosi dreamorosi moved this from Triage to Backlog in Powertools for AWS Lambda (TypeScript) Apr 18, 2024
@arnabrahman
Copy link
Contributor

Sorry, I saw no assignees for this issue and just went ahead with the PR. @dreamorosi

@dreamorosi
Copy link
Contributor Author

Hi @arnabrahman, nice to see you again! It's all good, thank you for taking this issue and submitting a PR!

Tomorrow morning I'll review it and get it merged 😊

Copy link
Contributor

⚠️ COMMENT VISIBILITY WARNING ⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

@dreamorosi dreamorosi moved this from Coming soon to Shipped in Powertools for AWS Lambda (TypeScript) Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed The scope is clear, ready for implementation good-first-issue Something that is suitable for those who want to start contributing help-wanted We would really appreciate some support from community for this one tracer This item relates to the Tracer Utility
Projects
2 participants