Skip to content

Commit 346d895

Browse files
committed
Merge branch 'master' into di-loading
* master: DEBUG-3210 DI: change logging to be appropriate for customer inspection (DataDog#4266) Report timing information if try_wait_until times out (DataDog#4265) Move simplecov patch to an overlay in our tree instead of using a forked simplecov repo (DataDog#4263) DEBUG-3251 dependency inject logger into DI component (DataDog#4262) DEBUG-3182 move Rails utils to core (DataDog#4261) add supported versions workflow (DataDog#4210) DEBUG-3305 remove dependency on benchmark (DataDog#4259) Fix case & grammar in issue template (DataDog#4244) [🤖] Update Latest Dependency: https://github.com/DataDog/dd-trace-rb/actions/runs/12614773826
2 parents a9f892f + 2e98fc4 commit 346d895

File tree

1,164 files changed

+4696
-7647
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,164 files changed

+4696
-7647
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ body:
6565

6666
- type: textarea
6767
attributes:
68-
label: How does Datadog Help You
68+
label: How does Datadog help you?
6969
description: "Optionally, tell us why and how you're using datadog, and what your overall experience with it is!"
7070
validations:
7171
required: false
+149
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
require 'pathname'
2+
require 'rubygems'
3+
require 'json'
4+
require 'bundler'
5+
6+
lib = File.expand_path('lib', __dir__)
7+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
8+
require 'datadog'
9+
10+
class GemfileProcessor
11+
SPECIAL_CASES = {
12+
"opensearch" => "OpenSearch" # special case because opensearch = OpenSearch not Opensearch
13+
}.freeze
14+
EXCLUDED_INTEGRATIONS = ["configuration", "propagation", "utils"].freeze
15+
16+
def initialize(directory: 'gemfiles/', contrib_dir: 'lib/datadog/tracing/contrib/')
17+
@directory = directory
18+
@contrib_dir = contrib_dir
19+
@min_gems = { 'ruby' => {}, 'jruby' => {} }
20+
@max_gems = { 'ruby' => {}, 'jruby' => {} }
21+
@integration_json_mapping = {}
22+
end
23+
24+
def process
25+
parse_gemfiles
26+
process_integrations
27+
include_hardcoded_versions
28+
write_output
29+
end
30+
31+
private
32+
33+
34+
def parse_gemfiles(directory = 'gemfiles/')
35+
gemfiles = Dir.glob(File.join(@directory, '*'))
36+
gemfiles.each do |gemfile_name|
37+
runtime = File.basename(gemfile_name).split('_').first # ruby or jruby
38+
next unless %w[ruby jruby].include?(runtime)
39+
# parse the gemfile
40+
if gemfile_name.end_with?(".gemfile")
41+
process_gemfile(gemfile_name, runtime)
42+
elsif gemfile_name.end_with?('.gemfile.lock')
43+
process_lockfile(gemfile_name, runtime)
44+
end
45+
end
46+
47+
end
48+
49+
def process_gemfile(gemfile_name, runtime)
50+
begin
51+
definition = Bundler::Definition.build(gemfile_name, nil, nil)
52+
definition.dependencies.each do |dependency|
53+
gem_name = dependency.name
54+
version = dependency.requirement.to_s
55+
update_gem_versions(runtime, gem_name, version)
56+
end
57+
rescue Bundler::GemfileError => e
58+
puts "Error reading Gemfile: #{e.message}"
59+
end
60+
end
61+
62+
def process_lockfile(gemfile_name, runtime)
63+
lockfile_contents = File.read(gemfile_name)
64+
parser = Bundler::LockfileParser.new(lockfile_contents)
65+
parser.specs.each do |spec|
66+
gem_name = spec.name
67+
version = spec.version.to_s
68+
update_gem_versions(runtime, gem_name, version)
69+
end
70+
end
71+
72+
def update_gem_versions(runtime, gem_name, version)
73+
return unless version_valid?(version)
74+
75+
gem_version = Gem::Version.new(version)
76+
77+
# Update minimum gems
78+
if @min_gems[runtime][gem_name].nil? || gem_version < Gem::Version.new(@min_gems[runtime][gem_name])
79+
@min_gems[runtime][gem_name] = version
80+
end
81+
82+
# Update maximum gems
83+
if @max_gems[runtime][gem_name].nil? || gem_version > Gem::Version.new(@max_gems[runtime][gem_name])
84+
@max_gems[runtime][gem_name] = version
85+
end
86+
end
87+
88+
# Helper: Validate the version format
89+
def version_valid?(version)
90+
return false if version.nil? || version.strip.empty?
91+
92+
Gem::Version.new(version)
93+
true
94+
rescue ArgumentError
95+
false
96+
end
97+
98+
99+
def process_integrations
100+
integrations = Datadog::Tracing::Contrib::REGISTRY.map(&:name).map(&:to_s)
101+
integrations.each do |integration|
102+
next if EXCLUDED_INTEGRATIONS.include?(integration)
103+
104+
integration_name = resolve_integration_name(integration)
105+
106+
@integration_json_mapping[integration] = [
107+
@min_gems['ruby'][integration_name],
108+
@max_gems['ruby'][integration_name],
109+
@min_gems['jruby'][integration_name],
110+
@max_gems['jruby'][integration_name]
111+
]
112+
end
113+
end
114+
115+
def include_hardcoded_versions
116+
# `httpx` is maintained externally
117+
@integration_json_mapping['httpx'] = [
118+
'0.11', # Min version Ruby
119+
'0.11', # Max version Ruby
120+
nil, # Min version JRuby
121+
nil # Max version JRuby
122+
]
123+
124+
# `makara` is part of `activerecord`
125+
@integration_json_mapping['makara'] = [
126+
'0.3.5', # Min version Ruby
127+
'0.3.5', # Max version Ruby
128+
nil, # Min version JRuby
129+
nil # Max version JRuby
130+
]
131+
end
132+
133+
def resolve_integration_name(integration)
134+
mod_name = SPECIAL_CASES[integration] || integration.split('_').map(&:capitalize).join
135+
module_name = "Datadog::Tracing::Contrib::#{mod_name}"
136+
integration_module = Object.const_get(module_name)::Integration
137+
integration_module.respond_to?(:gem_name) ? integration_module.gem_name : integration
138+
rescue NameError, NoMethodError
139+
puts "Fallback for #{integration}: module or gem_name not found."
140+
integration
141+
end
142+
143+
def write_output
144+
@integration_json_mapping = @integration_json_mapping.sort.to_h
145+
File.write("gem_output.json", JSON.pretty_generate(@integration_json_mapping))
146+
end
147+
end
148+
149+
GemfileProcessor.new.process
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
require 'json'
2+
3+
input_file = 'gem_output.json'
4+
output_file = 'integration_versions.md'
5+
6+
data = JSON.parse(File.read(input_file))
7+
8+
comment = "# Integrations\n\n"
9+
header = "| Integration | Ruby Min | Ruby Max | JRuby Min | JRuby Max |\n"
10+
separator = "|-------------|----------|-----------|----------|----------|\n"
11+
rows = data.map do |integration_name, versions|
12+
ruby_min, ruby_max, jruby_min, jruby_max = versions.map { |v| v || "None" }
13+
"| #{integration_name} | #{ruby_min} | #{ruby_max} | #{jruby_min} | #{jruby_max} |"
14+
end
15+
16+
File.open(output_file, 'w') do |file|
17+
file.puts comment
18+
file.puts header
19+
file.puts separator
20+
rows.each { |row| file.puts row }
21+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: "Generate Supported Versions"
2+
3+
on:
4+
workflow_dispatch:
5+
6+
7+
concurrency:
8+
group: ${{ github.workflow }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-22.04
14+
permissions:
15+
contents: read
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Ruby
21+
uses: ruby/setup-ruby@v1
22+
with:
23+
bundler-cache: true # runs bundle install
24+
ruby-version: "3.3"
25+
26+
- name: Update latest
27+
run: bundle exec ruby .github/scripts/find_gem_version_bounds.rb
28+
29+
- name: Generate versions table
30+
run: ruby .github/scripts/generate_table_versions.rb
31+
32+
- run: git diff
33+
34+
- name: Create Pull Request
35+
id: cpr
36+
uses: peter-evans/create-pull-request@v7
37+
with:
38+
token: ${{ secrets.GHA_PAT }}
39+
branch: auto-generate/update-supported-versions
40+
title: '[🤖] Update Supported Versions'
41+
base: master
42+
labels: dev/internal, integrations
43+
commit-message: "Test creating supported versions"
44+
delete-branch: true
45+
body: |
46+
This is a PR to update the table for supported integration versions.
47+
Workflow run: [Generate Supported Versions](https://github.com/DataDog/dd-trace-rb/actions/workflows/generate-supported-versions.yml)
48+
This should be tied to tracer releases, or triggered manually.
49+

Rakefile

+1
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ namespace :coverage do
402402
# Generates one report for each Ruby version
403403
task :report_per_ruby_version do
404404
require 'simplecov'
405+
require_relative 'spec/support/simplecov_fix'
405406

406407
versions = Dir["#{ENV.fetch('COVERAGE_DIR', 'coverage')}/versions/*"].map { |f| File.basename(f) }
407408
versions.map do |version|

Steepfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ target :datadog do
8989
ignore 'lib/datadog/core/configuration/option_definition_set.rb'
9090
ignore 'lib/datadog/core/configuration/options.rb'
9191
ignore 'lib/datadog/core/configuration/settings.rb'
92+
ignore 'lib/datadog/core/contrib/rails/utils.rb'
9293
ignore 'lib/datadog/core/diagnostics/health.rb'
9394
ignore 'lib/datadog/core/encoding.rb'
9495
ignore 'lib/datadog/core/environment/container.rb'
@@ -426,7 +427,6 @@ target :datadog do
426427
ignore 'lib/datadog/tracing/contrib/rails/middlewares.rb'
427428
ignore 'lib/datadog/tracing/contrib/rails/patcher.rb'
428429
ignore 'lib/datadog/tracing/contrib/rails/railtie.rb'
429-
ignore 'lib/datadog/tracing/contrib/rails/utils.rb'
430430
ignore 'lib/datadog/tracing/contrib/rake/configuration/settings.rb'
431431
ignore 'lib/datadog/tracing/contrib/rake/ext.rb'
432432
ignore 'lib/datadog/tracing/contrib/rake/instrumentation.rb'

gemfiles/jruby_9.2_activesupport.gemfile

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gemfiles/jruby_9.2_activesupport.gemfile.lock

+6-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gemfiles/jruby_9.2_aws.gemfile

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gemfiles/jruby_9.2_aws.gemfile.lock

+6-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gemfiles/jruby_9.2_contrib.gemfile

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)