From 934b7e28972265aea7d831d55e7a4ef531f9d9b7 Mon Sep 17 00:00:00 2001 From: quinna-h Date: Wed, 15 Jan 2025 12:42:36 -0500 Subject: [PATCH 1/3] update contribs --- .github/scripts/find_gem_version_bounds.rb | 19 +++++++++---------- .../tracing/contrib/aws/integration.rb | 2 +- .../tracing/contrib/http/integration.rb | 3 +++ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/scripts/find_gem_version_bounds.rb b/.github/scripts/find_gem_version_bounds.rb index da1366d737a..5d2449b05f6 100644 --- a/.github/scripts/find_gem_version_bounds.rb +++ b/.github/scripts/find_gem_version_bounds.rb @@ -9,7 +9,7 @@ class GemfileProcessor SPECIAL_CASES = { - "opensearch" => "OpenSearch" # special case because opensearch = OpenSearch not Opensearch + "opensearch" => "OpenSearch", # special case because opensearch = OpenSearch not Opensearch }.freeze EXCLUDED_INTEGRATIONS = ["configuration", "propagation", "utils"].freeze @@ -86,7 +86,6 @@ def update_gem_versions(runtime, gem_name, version, unspecified) # Update maximum gems if unspecified - puts "Setting gem #{gem_name} to infinity" @max_gems[runtime][gem_name] = Float::INFINITY else if @max_gems[runtime][gem_name].nil? || (@max_gems[runtime][gem_name] != Float::INFINITY && gem_version > Gem::Version.new(@max_gems[runtime][gem_name])) @@ -125,18 +124,18 @@ def process_integrations def include_hardcoded_versions # `httpx` is maintained externally @integration_json_mapping['httpx'] = [ - '0.11', # Min version Ruby - nil, # Max version Ruby - '0.11', # Min version JRuby - nil # Max version JRuby + '0.11', # Min version Ruby + 'infinity', # Max version Ruby + '0.11', # Min version JRuby + 'infinity' # Max version JRuby ] # `makara` is part of `activerecord` @integration_json_mapping['makara'] = [ - '0.3.5', # Min version Ruby - nil, # Max version Ruby - '0.3.5', # Min version JRuby - nil # Max version JRuby + '0.3.5', # Min version Ruby + 'infinity', # Max version Ruby + '0.3.5', # Min version JRuby + 'infinity' # Max version JRuby ] end diff --git a/lib/datadog/tracing/contrib/aws/integration.rb b/lib/datadog/tracing/contrib/aws/integration.rb index 167ea1be49a..233c67d5ab9 100644 --- a/lib/datadog/tracing/contrib/aws/integration.rb +++ b/lib/datadog/tracing/contrib/aws/integration.rb @@ -17,7 +17,7 @@ class Integration # @public_api Changing the integration name or integration options can cause breaking changes register_as :aws, auto_patch: true def self.gem_name - 'aws-sdk-core' + 'aws-sdk' end def self.version diff --git a/lib/datadog/tracing/contrib/http/integration.rb b/lib/datadog/tracing/contrib/http/integration.rb index f2cacaf94b3..b8482a13df5 100644 --- a/lib/datadog/tracing/contrib/http/integration.rb +++ b/lib/datadog/tracing/contrib/http/integration.rb @@ -22,6 +22,9 @@ class Integration # @public_api Changing the integration name or integration options can cause breaking changes register_as :http, auto_patch: true + def self.gem_name + 'net-http' + end def self.version Gem::Version.new(RUBY_VERSION) From e4586438b51b38828854ba8d2eb952a903655d7c Mon Sep 17 00:00:00 2001 From: quinna-h Date: Wed, 15 Jan 2025 13:41:42 -0500 Subject: [PATCH 2/3] wip --- .github/scripts/find_gem_version_bounds.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/scripts/find_gem_version_bounds.rb b/.github/scripts/find_gem_version_bounds.rb index 5d2449b05f6..87489330b92 100644 --- a/.github/scripts/find_gem_version_bounds.rb +++ b/.github/scripts/find_gem_version_bounds.rb @@ -53,9 +53,6 @@ def process_gemfile(gemfile_name, runtime) gem_name = dependency.name version = dependency.requirement.to_s unspecified = version.strip == '' || version == ">= 0" - if unspecified - puts "#{gem_name} uses latest" - end update_gem_versions(runtime, gem_name, version, unspecified) end rescue Bundler::GemfileError => e From db71f90c02c6fc36dc8df97244dd9c8bc1186df0 Mon Sep 17 00:00:00 2001 From: quinna-h Date: Wed, 15 Jan 2025 17:23:16 -0500 Subject: [PATCH 3/3] update script --- .github/scripts/find_gem_version_bounds.rb | 22 ++-------------------- .github/scripts/generate_table_versions.rb | 4 ---- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/.github/scripts/find_gem_version_bounds.rb b/.github/scripts/find_gem_version_bounds.rb index 87489330b92..6663c957182 100644 --- a/.github/scripts/find_gem_version_bounds.rb +++ b/.github/scripts/find_gem_version_bounds.rb @@ -37,29 +37,13 @@ def parse_gemfiles(directory = 'gemfiles/') runtime = File.basename(gemfile_name).split('_').first # ruby or jruby next unless %w[ruby jruby].include?(runtime) # parse the gemfile - if gemfile_name.end_with?(".gemfile") - process_gemfile(gemfile_name, runtime) - elsif gemfile_name.end_with?('.gemfile.lock') + if gemfile_name.end_with?('.gemfile.lock') process_lockfile(gemfile_name, runtime) end end end - def process_gemfile(gemfile_name, runtime) - begin - definition = Bundler::Definition.build(gemfile_name, nil, nil) - definition.dependencies.each do |dependency| - gem_name = dependency.name - version = dependency.requirement.to_s - unspecified = version.strip == '' || version == ">= 0" - update_gem_versions(runtime, gem_name, version, unspecified) - end - rescue Bundler::GemfileError => e - puts "Error reading Gemfile: #{e.message}" - end - end - def process_lockfile(gemfile_name, runtime) lockfile_contents = File.read(gemfile_name) parser = Bundler::LockfileParser.new(lockfile_contents) @@ -98,6 +82,7 @@ def version_valid?(version, unspecified) Gem::Version.new(version) true rescue ArgumentError + puts "#{version} is invalid format." false end @@ -148,9 +133,6 @@ def resolve_integration_name(integration) def write_output @integration_json_mapping = @integration_json_mapping.sort.to_h - @integration_json_mapping.each do |integration, versions| - versions.map! { |v| v == Float::INFINITY ? 'infinity' : v } - end File.write("gem_output.json", JSON.pretty_generate(@integration_json_mapping)) end end diff --git a/.github/scripts/generate_table_versions.rb b/.github/scripts/generate_table_versions.rb index 46068adeb0e..958e54a53a8 100644 --- a/.github/scripts/generate_table_versions.rb +++ b/.github/scripts/generate_table_versions.rb @@ -10,11 +10,7 @@ separator = "|-------------|----------|-----------|----------|----------|\n" rows = data.map do |integration_name, versions| ruby_min, ruby_max, jruby_min, jruby_max = versions.map do |v| - if v == "infinity" - "latest" - else v || "None" - end end "| #{integration_name} | #{ruby_min} | #{ruby_max} | #{jruby_min} | #{jruby_max} |" end