Skip to content

Commit 9d3f807

Browse files
committed
Merge branch 'master' into graphql-error-event
2 parents 703c56f + 8dba6cb commit 9d3f807

File tree

1,083 files changed

+11438
-2018
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,083 files changed

+11438
-2018
lines changed

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
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

.github/CODEOWNERS

Lines changed: 30 additions & 30 deletions
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

.github/scripts/find_gem_version_bounds.rb

Lines changed: 11 additions & 33 deletions
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

.github/scripts/generate_table_versions.rb

Lines changed: 0 additions & 4 deletions
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

.gitignore

Lines changed: 1 addition & 1 deletion
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

.gitlab/prepare-oci-package.sh

Lines changed: 5 additions & 0 deletions
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

.rubocop.yml

Lines changed: 3 additions & 0 deletions
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

Matrixfile

Lines changed: 3 additions & 0 deletions
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',

Rakefile

Lines changed: 8 additions & 1 deletion
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,

appraisal/ruby-3.3.rb

Lines changed: 8 additions & 0 deletions
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

0 commit comments

Comments
 (0)