Skip to content

Maintenance: avoid attaching two middlewares when appending UA to AWS SDK #1578

Closed
@dreamorosi

Description

@dreamorosi

Summary

In #1577, #1575, and #1567 we have added logic that appends a user agent to AWS SDK requests by leveraging the middleware stack of the AWS SDK v3. The current setup however does not take in account the fact that customers might pass us the same client more than once (i.e. create a client > instrument it with Tracer > pass it to Parameters / Idempotency).

Why is this needed?

The current implementation will log a warning that informs the user that Powertools was not able to apply the middleware, this could be misleading.

Which area does this relate to?

Other

Solution

We should make sure that this case is handled correctly by either: 1/ making the operation idempotent (like the X-Ray SDK itself does when instrumenting), 2/ appending the second user agent (like suggested here), 3/ converting operation to a no-op if the middleware is already there.

Acknowledgment

Future readers

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

Metadata

Metadata

Assignees

Labels

commonsThis item relates to the Commons UtilitycompletedThis item is complete and has been merged/shippedinternalPRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions