diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f6d5c59..bbc3275e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,11 +11,11 @@ on: jobs: test: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - ruby: ['2.0', 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, jruby-9.1, jruby-9.2, jruby-9.3, jruby-9.4] + ruby: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, jruby-9.1, jruby-9.2, jruby-9.3, jruby-9.4] env: [NEW_RAILS, OLD_RAILS] exclude: - ruby: '2.0' diff --git a/CHANGELOG.md b/CHANGELOG.md index 9856940b..85f5343a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Unreleased Changes ------------------ +* Issue - Improve User-Agent tracking and bump minimum DynamoDB version. + 2.10.1 (2023-01-17) ------------------ diff --git a/aws-record.gemspec b/aws-record.gemspec index 14793c7d..8fa3a155 100644 --- a/aws-record.gemspec +++ b/aws-record.gemspec @@ -13,5 +13,6 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.files = Dir['lib/**/*.rb', 'LICENSE', 'CHANGELOG.md', 'VERSION'] - spec.add_dependency('aws-sdk-dynamodb', '~> 1.18') + # Require 1.85.0 for user_agent_frameworks config + spec.add_dependency 'aws-sdk-dynamodb', '~> 1', '>= 1.85.0' end diff --git a/lib/aws-record/record/client_configuration.rb b/lib/aws-record/record/client_configuration.rb index 2930e80a..e94ca199 100644 --- a/lib/aws-record/record/client_configuration.rb +++ b/lib/aws-record/record/client_configuration.rb @@ -53,12 +53,9 @@ def dynamodb_client def _build_client(opts = {}) provided_client = opts.delete(:client) - opts[:user_agent_suffix] = _user_agent(opts.delete(:user_agent_suffix)) - provided_client || Aws::DynamoDB::Client.new(opts) - end - - def _user_agent(custom) - custom || " aws-record/#{VERSION}" + client = provided_client || Aws::DynamoDB::Client.new(opts) + client.config.user_agent_frameworks << 'aws-record' + client end end end diff --git a/lib/aws-record/record/table_config.rb b/lib/aws-record/record/table_config.rb index 3ef0d6cd..c921da8f 100644 --- a/lib/aws-record/record/table_config.rb +++ b/lib/aws-record/record/table_config.rb @@ -188,6 +188,7 @@ def client_options(opts) # @api private def configure_client @client = Aws::DynamoDB::Client.new(@client_options) + @client.config.user_agent_frameworks << 'aws-record' end # @api private diff --git a/lib/aws-record/record/table_migration.rb b/lib/aws-record/record/table_migration.rb index 50a3ac80..d50dd7e8 100644 --- a/lib/aws-record/record/table_migration.rb +++ b/lib/aws-record/record/table_migration.rb @@ -20,6 +20,7 @@ def initialize(model, opts = {}) _assert_model_valid(model) @model = model @client = opts[:client] || model.dynamodb_client || Aws::DynamoDB::Client.new + @client.config.user_agent_frameworks << 'aws-record' end # This method calls