Skip to content

User Agent #310

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

Open
wants to merge 14 commits into
base: decaf
Choose a base branch
from
Open

User Agent #310

wants to merge 14 commits into from

Conversation

richardwang1124
Copy link
Contributor

Add user agent plugin and test.

module Client
module Plugins
class UserAgent < Plugin
option(:user_agent_suffix)
Copy link
Contributor

@mullermp mullermp Jul 9, 2025

Choose a reason for hiding this comment

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

In v3 this was secret. I think we should fully document this as a public option in the generic client. In v4 we can keep it secret or remove it. Or, we can use app id concept instead. Let's discuss


require_relative '../../spec_helper'

require 'smithy-client/plugins/user_agent'
Copy link
Contributor

Choose a reason for hiding this comment

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

Require is not necessary anymore

option(
:user_agent_suffix,
doc_type: String,
docstring: 'The suffix appended to the user agent string.'
Copy link
Contributor

Choose a reason for hiding this comment

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

String -> header

Comment on lines 137 to 143
def with_metric(&block)
Thread.current[:aws_sdk_core_user_agent_metric] ||= []
Thread.current[:aws_sdk_core_user_agent_metric] << 'C'
block.call
ensure
Thread.current[:aws_sdk_core_user_agent_metric].pop
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we put a TODO to revisit this approach? Just want to make sure that this does not go amiss

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