Skip to content

Commit a84180c

Browse files
authored
Merge branch 'master' into auto-generate/update-supported-versions
2 parents 475c6f5 + 8dba6cb commit a84180c

File tree

1,121 files changed

+13358
-2643
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,121 files changed

+13358
-2643
lines changed

Diff for: .circleci/config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ orbs:
275275
name: Upload JUnit reports to Datadog
276276
when: always
277277
command: |
278+
sed -i 's/file="\.\//file="/g' tmp/rspec/*.xml
279+
278280
ls -l tmp/rspec/*.xml
279281
280282
curl -L --fail --retry 3 "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_linux-x64" --output "/usr/local/bin/datadog-ci" && chmod +x /usr/local/bin/datadog-ci

Diff for: .github/CODEOWNERS

+30-30
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
* @DataDog/ruby-guild
22

33
# Public Documentation
4-
/docs/Compatibility.md @DataDog/documentation
5-
/docs/GettingStarted.md @DataDog/documentation
4+
docs/Compatibility.md @DataDog/documentation
5+
docs/GettingStarted.md @DataDog/documentation
66

77
# Library
8-
/lib/datadog/appsec/ @DataDog/asm-ruby
9-
/lib/datadog/appsec.rb @DataDog/asm-ruby
10-
/lib/datadog/tracing/ @DataDog/tracing-ruby
11-
/lib/datadog/tracing/contrib/ @DataDog/apm-idm-ruby
12-
/lib/datadog/tracing.rb @DataDog/tracing-ruby
13-
/lib/datadog/opentelemetry/ @DataDog/tracing-ruby
14-
/lib/datadog/opentelemetry.rb @DataDog/tracing-ruby
15-
/lib-injection/ @DataDog/tracing-ruby
16-
/lib/datadog/profiling/ @DataDog/profiling-rb @DataDog/ruby-guild
17-
/lib/datadog/profiling.rb @DataDog/profiling-rb @DataDog/ruby-guild
18-
/ext/ @DataDog/profiling-rb @DataDog/ruby-guild
8+
lib/datadog/appsec/ @DataDog/asm-ruby
9+
lib/datadog/appsec.rb @DataDog/asm-ruby
10+
lib/datadog/tracing/ @DataDog/tracing-ruby
11+
lib/datadog/tracing/contrib/ @DataDog/apm-idm-ruby
12+
lib/datadog/tracing.rb @DataDog/tracing-ruby
13+
lib/datadog/opentelemetry/ @DataDog/tracing-ruby
14+
lib/datadog/opentelemetry.rb @DataDog/tracing-ruby
15+
lib-injection/ @DataDog/tracing-ruby
16+
lib/datadog/profiling/ @DataDog/profiling-rb @DataDog/ruby-guild
17+
lib/datadog/profiling.rb @DataDog/profiling-rb @DataDog/ruby-guild
18+
ext/ @DataDog/profiling-rb @DataDog/ruby-guild
1919

2020
# RBS signatures
21-
/sig/datadog/appsec/ @DataDog/asm-ruby
22-
/sig/datadog/appsec.rbs @DataDog/asm-ruby
23-
/sig/datadog/tracing/ @DataDog/tracing-ruby
24-
/sig/datadog/tracing/contrib/ @DataDog/apm-idm-ruby
25-
/sig/datadog/tracing.rbs @DataDog/tracing-ruby
26-
/sig/datadog/opentelemetry/ @DataDog/tracing-ruby
27-
/sig/datadog/opentelemetry.rbs @DataDog/tracing-ruby
28-
/sig/datadog/profiling/ @DataDog/profiling-rb @DataDog/ruby-guild
29-
/sig/datadog/profiling.rbs @DataDog/profiling-rb @DataDog/ruby-guild
21+
sig/datadog/appsec/ @DataDog/asm-ruby
22+
sig/datadog/appsec.rbs @DataDog/asm-ruby
23+
sig/datadog/tracing/ @DataDog/tracing-ruby
24+
sig/datadog/tracing/contrib/ @DataDog/apm-idm-ruby
25+
sig/datadog/tracing.rbs @DataDog/tracing-ruby
26+
sig/datadog/opentelemetry/ @DataDog/tracing-ruby
27+
sig/datadog/opentelemetry.rbs @DataDog/tracing-ruby
28+
sig/datadog/profiling/ @DataDog/profiling-rb @DataDog/ruby-guild
29+
sig/datadog/profiling.rbs @DataDog/profiling-rb @DataDog/ruby-guild
3030

3131
# Specs
32-
/spec/datadog/appsec/ @DataDog/asm-ruby
33-
/spec/datadog/tracing/ @DataDog/tracing-ruby
34-
/spec/datadog/tracing/contrib/ @DataDog/apm-idm-ruby
35-
/spec/datadog/tracing_spec.rb @DataDog/tracing-ruby
36-
/spec/datadog/opentelemetry/ @DataDog/tracing-ruby
37-
/spec/datadog/opentelemetry_spec.rb @DataDog/tracing-ruby
38-
/spec/datadog/profiling/ @DataDog/profiling-rb @DataDog/ruby-guild
39-
/spec/datadog/profiling_spec.rb @DataDog/profiling-rb @DataDog/ruby-guild
32+
spec/datadog/appsec/ @DataDog/asm-ruby
33+
spec/datadog/tracing/ @DataDog/tracing-ruby
34+
spec/datadog/tracing/contrib/ @DataDog/apm-idm-ruby
35+
spec/datadog/tracing_spec.rb @DataDog/tracing-ruby
36+
spec/datadog/opentelemetry/ @DataDog/tracing-ruby
37+
spec/datadog/opentelemetry_spec.rb @DataDog/tracing-ruby
38+
spec/datadog/profiling/ @DataDog/profiling-rb @DataDog/ruby-guild
39+
spec/datadog/profiling_spec.rb @DataDog/profiling-rb @DataDog/ruby-guild

Diff for: .github/scripts/find_gem_version_bounds.rb

+11-33
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class GemfileProcessor
1111
SPECIAL_CASES = {
12-
"opensearch" => "OpenSearch" # special case because opensearch = OpenSearch not Opensearch
12+
"opensearch" => "OpenSearch", # special case because opensearch = OpenSearch not Opensearch
1313
}.freeze
1414
EXCLUDED_INTEGRATIONS = ["configuration", "propagation", "utils"].freeze
1515

@@ -37,32 +37,13 @@ def parse_gemfiles(directory = 'gemfiles/')
3737
runtime = File.basename(gemfile_name).split('_').first # ruby or jruby
3838
next unless %w[ruby jruby].include?(runtime)
3939
# parse the gemfile
40-
if gemfile_name.end_with?(".gemfile")
41-
process_gemfile(gemfile_name, runtime)
42-
elsif gemfile_name.end_with?('.gemfile.lock')
40+
if gemfile_name.end_with?('.gemfile.lock')
4341
process_lockfile(gemfile_name, runtime)
4442
end
4543
end
4644

4745
end
4846

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-
unspecified = version.strip == '' || version == ">= 0"
56-
if unspecified
57-
puts "#{gem_name} uses latest"
58-
end
59-
update_gem_versions(runtime, gem_name, version, unspecified)
60-
end
61-
rescue Bundler::GemfileError => e
62-
puts "Error reading Gemfile: #{e.message}"
63-
end
64-
end
65-
6647
def process_lockfile(gemfile_name, runtime)
6748
lockfile_contents = File.read(gemfile_name)
6849
parser = Bundler::LockfileParser.new(lockfile_contents)
@@ -86,7 +67,6 @@ def update_gem_versions(runtime, gem_name, version, unspecified)
8667

8768
# Update maximum gems
8869
if unspecified
89-
puts "Setting gem #{gem_name} to infinity"
9070
@max_gems[runtime][gem_name] = Float::INFINITY
9171
else
9272
if @max_gems[runtime][gem_name].nil? || (@max_gems[runtime][gem_name] != Float::INFINITY && gem_version > Gem::Version.new(@max_gems[runtime][gem_name]))
@@ -102,6 +82,7 @@ def version_valid?(version, unspecified)
10282
Gem::Version.new(version)
10383
true
10484
rescue ArgumentError
85+
puts "#{version} is invalid format."
10586
false
10687
end
10788

@@ -125,18 +106,18 @@ def process_integrations
125106
def include_hardcoded_versions
126107
# `httpx` is maintained externally
127108
@integration_json_mapping['httpx'] = [
128-
'0.11', # Min version Ruby
129-
nil, # Max version Ruby
130-
'0.11', # Min version JRuby
131-
nil # Max version JRuby
109+
'0.11', # Min version Ruby
110+
'infinity', # Max version Ruby
111+
'0.11', # Min version JRuby
112+
'infinity' # Max version JRuby
132113
]
133114

134115
# `makara` is part of `activerecord`
135116
@integration_json_mapping['makara'] = [
136-
'0.3.5', # Min version Ruby
137-
nil, # Max version Ruby
138-
'0.3.5', # Min version JRuby
139-
nil # Max version JRuby
117+
'0.3.5', # Min version Ruby
118+
'infinity', # Max version Ruby
119+
'0.3.5', # Min version JRuby
120+
'infinity' # Max version JRuby
140121
]
141122
end
142123

@@ -152,9 +133,6 @@ def resolve_integration_name(integration)
152133

153134
def write_output
154135
@integration_json_mapping = @integration_json_mapping.sort.to_h
155-
@integration_json_mapping.each do |integration, versions|
156-
versions.map! { |v| v == Float::INFINITY ? 'infinity' : v }
157-
end
158136
File.write("gem_output.json", JSON.pretty_generate(@integration_json_mapping))
159137
end
160138
end

Diff for: .github/scripts/generate_table_versions.rb

-4
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@
1010
separator = "|-------------|----------|-----------|----------|----------|\n"
1111
rows = data.map do |integration_name, versions|
1212
ruby_min, ruby_max, jruby_min, jruby_max = versions.map do |v|
13-
if v == "infinity"
14-
"latest"
15-
else
1613
v || "None"
17-
end
1814
end
1915
"| #{integration_name} | #{ruby_min} | #{ruby_max} | #{jruby_min} | #{jruby_max} |"
2016
end

Diff for: .gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ ext/**/skipped_reason.txt
4444
# lock files
4545
Gemfile.lock
4646
Gemfile-*.lock
47-
*.gemfile.lock
47+
/*.gemfile.lock
4848

4949
# bundle config
5050
gemfiles/.bundle

Diff for: .gitlab/install_datadog_deps.rb

+2
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,14 @@
7878
'DD_PROFILING_NO_EXTENSION' => 'true',
7979
}
8080

81+
# ADD NEW DEPENDENCIES HERE
8182
[
8283
'datadog-ruby_core_source',
8384
'ffi',
8485
'libddwaf',
8586
'msgpack',
8687
'libdatadog', # libdatadog MUST be installed before datadog to ensure libdatadog native extension is compiled
88+
'logger',
8789
'datadog',
8890
].each do |gem|
8991
version = gem_version_mapping.delete(gem)

Diff for: .gitlab/prepare-oci-package.sh

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
set -e
44

5+
if [ "$OS" != "linux" ]; then
6+
echo "Only linux packages are supported. Exiting"
7+
exit 0
8+
fi
9+
510
mkdir sources
611

712
cp ../lib-injection/host_inject.rb sources

Diff for: .gitlab/scripts/vaccine.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44

55
GH_VACCINE_PAT=$(vault kv get -field=vaccine-token kv/k8s/gitlab-runner/dd-trace-rb/github-token)
6-
REPO="TonyCTHsu/vaccine" # To be migrated
6+
REPO="Datadog/vaccine"
77
POLL_INTERVAL=60 # seconds
88

99
# Trigger workflow

Diff for: .rubocop.yml

+3
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,9 @@ Lint/UnusedBlockArgument:
425425
Style/TrailingCommaInArguments:
426426
Enabled: false
427427

428+
Style/TrailingUnderscoreVariable:
429+
Enabled: false
430+
428431
Style/TrailingCommaInArrayLiteral:
429432
Enabled: false
430433

Diff for: Matrixfile

+3
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@
271271
# Non-deprecated form of Regexp.new does not backport to Rack 1.x, see: https://github.com/rack/rack/pull/1998
272272
'rack-1' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ❌ 3.3 / ❌ 3.4 / ✅ jruby',
273273
},
274+
'appsec:integration' => {
275+
'rack-activerecord' => '❌ 2.5 / ❌ 2.6 / ❌ 2.7 / ❌ 3.0 / ❌ 3.1 / ❌ 3.2 / ✅ 3.3 / ❌ 3.4 / ❌ jruby',
276+
},
274277
'appsec:sinatra' => {
275278
'sinatra-2' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
276279
'sinatra-3' => '❌ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',

Diff for: Rakefile

+8-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ namespace :spec do
276276
end
277277

278278
namespace :appsec do
279-
task all: [:main, :active_record, :rack, :rails, :sinatra, :devise, :graphql]
279+
task all: [:main, :active_record, :rack, :rails, :sinatra, :devise, :graphql, :integration]
280280

281281
# Datadog AppSec main specs
282282
desc '' # "Explicitly hiding from `rake -T`"
@@ -287,6 +287,13 @@ namespace :spec do
287287
t.rspec_opts = args.to_a.join(' ')
288288
end
289289

290+
# Datadog AppSec integration specs
291+
desc '' # "Explicitly hiding from `rake -T`"
292+
RSpec::Core::RakeTask.new(:integration) do |t, args|
293+
t.pattern = 'spec/datadog/appsec/contrib/integration/**/*_spec.rb'
294+
t.rspec_opts = args.to_a.join(' ')
295+
end
296+
290297
# Datadog AppSec integrations
291298
[
292299
:active_record,

Diff for: appraisal/ruby-3.3.rb

+8
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,11 @@
185185
appraise 'core-old' do
186186
gem 'dogstatsd-ruby', '~> 4'
187187
end
188+
189+
appraise 'rack-activerecord' do
190+
gem "rack", "~> 2"
191+
gem 'rack-contrib'
192+
gem 'rack-test' # Dev dependencies for testing rack-based code
193+
gem "activerecord", "~> 7"
194+
gem "sqlite3", ">= 1.4.2", platform: :ruby
195+
end

Diff for: benchmarks/profiler_memory_sample_serialize.rb

+19-11
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# This benchmark measures the performance of sampling + serializing memory profiles. It enables us to evaluate changes to
1313
# the profiler and/or libdatadog that may impact both individual samples, as well as samples over time.
1414
#
15-
METRIC_VALUES = { 'cpu-time' => 0, 'cpu-samples' => 0, 'wall-time' => 0, 'alloc-samples' => 1, 'timeline' => 0 }.freeze
15+
METRIC_VALUES = { 'cpu-time' => 0, 'cpu-samples' => 0, 'wall-time' => 0, 'alloc-samples' => 1, 'timeline' => 0, 'heap_sample' => true }.freeze
1616
OBJECT_CLASS = 'object'.freeze
1717

1818
def sample_object(recorder, depth = 0)
@@ -56,6 +56,21 @@ def setup
5656
}
5757
end
5858

59+
def create_objects(recorder)
60+
samples_per_second = 100
61+
simulate_seconds = 60
62+
retained_objs = []
63+
64+
(samples_per_second * simulate_seconds).times do |i|
65+
obj = sample_object(recorder, i % 400)
66+
retained_objs << obj if (i % @retain_every).zero?
67+
end
68+
69+
GC.start unless @skip_end_gc
70+
71+
retained_objs
72+
end
73+
5974
def run_benchmark
6075
Benchmark.ips do |x|
6176
benchmark_time = VALIDATE_BENCHMARK_MODE ? { time: 0.01, warmup: 0 } : { time: 30, warmup: 2 }
@@ -65,18 +80,11 @@ def run_benchmark
6580

6681
x.report("sample+serialize #{ENV['CONFIG']} retain_every=#{@retain_every} heap_samples=#{@heap_samples_enabled} heap_size=#{@heap_size_enabled} heap_sample_every=#{@heap_sample_every} skip_end_gc=#{@skip_end_gc}") do
6782
recorder = @recorder_factory.call
68-
samples_per_second = 100
69-
simulate_seconds = 60
70-
retained_objs = []
71-
72-
(samples_per_second * simulate_seconds).times do |i|
73-
obj = sample_object(recorder, i % 400)
74-
retained_objs << obj if (i % @retain_every).zero?
75-
end
76-
77-
GC.start unless @skip_end_gc
83+
retained_objs = create_objects(recorder)
7884

7985
recorder.serialize
86+
87+
retained_objs.size # Dummy action to make sure this is still alive
8088
end
8189

8290
x.save! "#{File.basename(__FILE__)}-results.json" unless VALIDATE_BENCHMARK_MODE

Diff for: datadog.gemspec

+11-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Gem::Specification.new do |spec|
6262
spec.add_dependency 'msgpack'
6363

6464
# Used by the profiler native extension to support Ruby 2.5 and > 3.2, see NativeExtensionDesign.md for details
65-
spec.add_dependency 'datadog-ruby_core_source', '~> 3.3', '>= 3.3.7'
65+
spec.add_dependency 'datadog-ruby_core_source', '~> 3.4'
6666

6767
# Used by appsec
6868
spec.add_dependency 'libddwaf', '~> 1.18.0.0.0'
@@ -71,6 +71,16 @@ Gem::Specification.new do |spec|
7171
# (and yes we have a test for it)
7272
spec.add_dependency 'libdatadog', '~> 14.3.1.1.0'
7373

74+
# Will no longer be a default gem on Ruby 3.5, see
75+
# https://github.com/ruby/ruby/commit/d7e558e3c48c213d0e8bedca4fb547db55613f7c and
76+
# https://stdgems.org/ .
77+
# We support all versions of this gem and don't particularly require any version restriction.
78+
spec.add_dependency 'logger'
79+
80+
# Tip: When adding or removing dependencies, search the codebase for the string
81+
# ADD NEW DEPENDENCIES HERE
82+
# to find out a few more places that need to be kept in-sync.
83+
7484
spec.extensions = [
7585
'ext/datadog_profiling_native_extension/extconf.rb',
7686
'ext/datadog_profiling_loader/extconf.rb',

0 commit comments

Comments
 (0)