Skip to content

Add feature usage tracking to the User-Agent header - #882

Open
ubaskota wants to merge 1 commit into
smithy-lang:developfrom
ubaskota:user_agent_metrics_scaffold
Open

ubaskota wants to merge 1 commit into
smithy-lang:developfrom
ubaskota:user_agent_metrics_scaffold

Conversation

@ubaskota

@ubaskota ubaskota commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:
Add a way to record which SDK features a call uses and report them in the User-Agent header's m/ section. Features are tracked per call with register_feature_id and the AwsFeatureId enum, and the AWS user agent interceptor appends them to the header after signing, without adding them twice on retries. This PR tracks features for retry mode and the
endpoint override.

Testing:
Added unit tests for registration, encoding and the header update, including retries, and integration tests with a generated client. Verified that all existing and new tests pass.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ubaskota
ubaskota requested a review from a team as a code owner November 1, 2026 21:52
Comment on lines +8 to +12
from smithy_core.aio.retries import (
RETRY_STRATEGY,
AsyncAdaptiveRetryStrategy,
AsyncStandardRetryStrategy,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should bump smithy-aws-core's smithy-core dependency to the release that introduces RETRY_STRATEGY. It still allows 0.9.x, so a valid installation can fail while importing this module

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally should not manually bump our dependency pins since this is handled automatically by our release infra. For something like this that is required by a dependent, a minor version should be triggered by either a breaking or feature changelog entry. Long term we can make this more fine-grain (this is probably more like an enhancement change, but that triggers a patch bump right now. We can probably add a new field in the future to override the bump type since not every feature is a minor bump and not every enhancement is a patch bump).

If this is merged before out next release, nothing should be needed since there already pending breaking changes and features for smithy-core. But adding a feature entry might be safer incase this is released after

"smithy_aws_core.aio.endpoints.standard_regional": {
"AsyncEndpointResolver": "rex-protocol[async]",
"AsyncStandardRegionalEndpointsResolver": "class[async]",
"AwsFeatureId": "rex-class",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we keep these implementation imports private? The snapshot is picking up a bunch of new exports from user_agent, standard_regional, and aio.client that don’t seem intentional

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants