Skip to content

Improve User-Agent tracking #132

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

Merged
merged 3 commits into from
Jun 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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'
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Unreleased Changes
------------------

* Issue - Improve User-Agent tracking and bump minimum DynamoDB version.

2.10.1 (2023-01-17)
------------------

3 changes: 2 additions & 1 deletion aws-record.gemspec
Original file line number Diff line number Diff line change
@@ -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
9 changes: 3 additions & 6 deletions lib/aws-record/record/client_configuration.rb
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions lib/aws-record/record/table_config.rb
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions lib/aws-record/record/table_migration.rb
Original file line number Diff line number Diff line change
@@ -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