Skip to content

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

@dreamorosi

Description

@dreamorosi

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.

Metadata

Metadata

Assignees

Labels

confirmedThe scope is clear, ready for implementationgood-first-issueSomething that is suitable for those who want to start contributinghelp-wantedWe would really appreciate some support from community for this onetracerThis item relates to the Tracer Utility

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions