Skip to content

Commit 962be02

Browse files
authored
Merge branch 'master' into zachg/fix_circ_import_for_lazy_sampling
2 parents 7396654 + 7fd1feb commit 962be02

File tree

1,245 files changed

+8954
-11423
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,245 files changed

+8954
-11423
lines changed

Diff for: .github/dependency_filters.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
dependencies:
22
- Gemfile
33
- '*.gemfile'
4-
- Appraisals
54
- datadog.gemspec
6-
- tasks/appraisal.rake
75
- tasks/dependency.rake
86
- .github/workflows/lock-dependency.yml
97
- lib/datadog/version.rb

Diff for: .github/workflows/codeql-analysis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
# Initializes the CodeQL tools for scanning.
3131
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@v2
32+
uses: github/codeql-action/init@v3
3333
with:
3434
languages: ${{ matrix.language }}
3535
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -40,7 +40,7 @@ jobs:
4040
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
4141
# If this step fails, then you should remove it and run the build manually
4242
- name: Autobuild
43-
uses: github/codeql-action/autobuild@v2
43+
uses: github/codeql-action/autobuild@v3
4444

4545
- name: Perform CodeQL Analysis
46-
uses: github/codeql-action/analyze@v2
46+
uses: github/codeql-action/analyze@v3

Diff for: .github/workflows/ensure-changelog-entry.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
with:
5858
github-token: ${{secrets.GITHUB_TOKEN}}
5959
script: |
60-
const regex = /\*\*Change log entry\*\*\s+(?:(?<answer_yes>yes|yep|yeah)(?:\.\s*(?<yes_message>[^\r\n<!-]+))?|(?<answer_no>no|nope|none)\.?)\s*/mi
60+
const regex = /\*\*Change log entry\*\*\s+(?:<!--.*?-->\s*)?(?:(?<answer_yes>yes|yep|yeah)(?:\s?[.,:-]\s?(?<yes_message>[^\r\n<!-]+))?|(?<answer_no>no|nope|none)\.?.*?)/ims
6161
const entry = context.payload.pull_request.body.match(regex)
6262
6363
const isWriteComment =

Diff for: .github/workflows/system-tests.yml

+1-7
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,7 @@ jobs:
272272
scenario: DEBUGGER_PROBES_STATUS
273273
- library: ruby
274274
app: rails70
275-
scenario: DEBUGGER_METHOD_PROBES_SNAPSHOT
276-
- library: ruby
277-
app: rails70
278-
scenario: DEBUGGER_LINE_PROBES_SNAPSHOT
279-
- library: ruby
280-
app: rails70
281-
scenario: DEBUGGER_MIX_LOG_PROBE
275+
scenario: DEBUGGER_PROBES_SNAPSHOT
282276
- library: ruby
283277
app: rails70
284278
scenario: DEBUGGER_PII_REDACTION

Diff for: .github/workflows/test-memory-leaks.yaml

+1-5
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ jobs:
1515
- run: gem update --system 3.5.23 # TODO: This is a workaround for a buggy rubygems in 3.4.0-preview2; remove once stable version 3.4 is out
1616
- run: bundle exec rake compile spec:profiling:memcheck
1717
test-asan:
18-
# Temporarily ruby-asan builds changes
19-
# from: `ruby 3.4.0dev (2024-11-07T14:35:19Z :detached: fca07d73e3) +PRISM [x86_64-linux]`
20-
# To: `ruby 3.4.0dev (2024-11-11T18:38:40Z :detached: 8672e88cd2) +PRISM [x86_64-linux]`
21-
if: false
2218
runs-on: ubuntu-24.04
2319
steps:
2420
- uses: actions/checkout@v4
@@ -27,5 +23,5 @@ jobs:
2723
ruby-version: asan
2824
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
2925
bundler: latest
30-
cache-version: v1 # bump this to invalidate cache
26+
cache-version: v2 # bump this to invalidate cache
3127
- run: env RUBY_FREE_AT_EXIT=1 LSAN_OPTIONS=verbosity=0:log_threads=1:suppressions=`pwd`/suppressions/lsan.supp ASAN_OPTIONS=detect_leaks=1 bundle exec rake spec:profiling:main

Diff for: Appraisals

-95
This file was deleted.

Diff for: CHANGELOG.md

+34-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,28 @@
22

33
## [Unreleased]
44

5+
## [2.8.0] - 2024-12-10
6+
7+
### Added
8+
9+
* DI: Dynamic instrumentation is now available in Ruby as a Preview
10+
* AppSec: Add SQL injection detection for ActiveRecord for following adapters: `mysql2`, `postgresql`, and `sqlite3` ([#4167][])
11+
* Telemetry: Add environment variable to disable logs ([#4153][])
12+
* Integrations: Add configuration option `on_error` to Elasticsearch tracing ([#4066][])
13+
14+
### Changed
15+
16+
* Upgrade libdatadog dependency to 14.3.1 ([#4196][])
17+
* Profiling: Require Ruby 3.1+ for heap profiling ([#4178][])
18+
* AppSec: Update libddwaf to 1.18.0.0.0 ([#4164][])
19+
* Single-step: Lower SSI GLIBC requirements down to 2.17 ([#4137][])
20+
21+
### Fixed
22+
23+
* Integrations: Avoid loading `ActiveSupport::Cache::RedisCacheStore`, which tries to load `redis >= 4.0.1` regardless of the version of Redis the host application has installed ([#4197][])
24+
* Profiling: Fix unsafe initialization when using profiler with otel tracing ([#4195][])
25+
* Single-step: Add safe NOOP injection script for very old rubies ([#4140][])
26+
527
## [2.7.1] - 2024-11-28
628

729
### Fixed
@@ -3035,7 +3057,8 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
30353057
Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
30363058
30373059
3038-
[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v2.7.0...master
3060+
[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v2.8.0...master
3061+
[2.8.0]: https://github.com/DataDog/dd-trace-rb/compare/v2.7.1...v2.8.0
30393062
[2.7.0]: https://github.com/DataDog/dd-trace-rb/compare/v2.6.0...v2.7.0
30403063
[2.6.0]: https://github.com/DataDog/dd-trace-rb/compare/v2.5.0...v2.6.0
30413064
[2.5.0]: https://github.com/DataDog/dd-trace-rb/compare/v2.4.0...v2.5.0
@@ -4480,12 +4503,22 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
44804503
[#4027]: https://github.com/DataDog/dd-trace-rb/issues/4027
44814504
[#4033]: https://github.com/DataDog/dd-trace-rb/issues/4033
44824505
[#4065]: https://github.com/DataDog/dd-trace-rb/issues/4065
4506+
[#4066]: https://github.com/DataDog/dd-trace-rb/issues/4066
44834507
[#4075]: https://github.com/DataDog/dd-trace-rb/issues/4075
44844508
[#4078]: https://github.com/DataDog/dd-trace-rb/issues/4078
44854509
[#4082]: https://github.com/DataDog/dd-trace-rb/issues/4082
44864510
[#4083]: https://github.com/DataDog/dd-trace-rb/issues/4083
44874511
[#4085]: https://github.com/DataDog/dd-trace-rb/issues/4085
4512+
[#4137]: https://github.com/DataDog/dd-trace-rb/issues/4137
4513+
[#4140]: https://github.com/DataDog/dd-trace-rb/issues/4140
4514+
[#4153]: https://github.com/DataDog/dd-trace-rb/issues/4153
44884515
[#4161]: https://github.com/DataDog/dd-trace-rb/issues/4161
4516+
[#4164]: https://github.com/DataDog/dd-trace-rb/issues/4164
4517+
[#4167]: https://github.com/DataDog/dd-trace-rb/issues/4167
4518+
[#4178]: https://github.com/DataDog/dd-trace-rb/issues/4178
4519+
[#4195]: https://github.com/DataDog/dd-trace-rb/issues/4195
4520+
[#4196]: https://github.com/DataDog/dd-trace-rb/issues/4196
4521+
[#4197]: https://github.com/DataDog/dd-trace-rb/issues/4197
44894522
[@AdrianLC]: https://github.com/AdrianLC
44904523
[@Azure7111]: https://github.com/Azure7111
44914524
[@BabyGroot]: https://github.com/BabyGroot

Diff for: Matrixfile

+3
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@
229229
'rails6-semantic-logger' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ❌ 3.0 / ❌ 3.1 / ❌ 3.2 / ❌ 3.3 / ❌ 3.4 / ✅ jruby',
230230
'rails61-semantic-logger' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby'
231231
},
232+
'rails_old_redis' => {
233+
'rails-old-redis' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
234+
},
232235
'action_cable' => {
233236
# FIXME: Enable the test for JRuby after fixing `log writing failed. closed stream` in CircleCI.
234237
'rails5-mysql2' => '✅ 2.5 / ✅ 2.6 / ❌ 2.7 / ❌ 3.0 / ❌ 3.1 / ❌ 3.2 / ❌ 3.3 / ❌ 3.4 / ❌ jruby',

Diff for: Rakefile

+9
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,15 @@ namespace :spec do
153153
t.rspec_opts = args.to_a.join(' ')
154154
end
155155

156+
# Tests if Datadog::Tracing::Contrib::ActiveSupport::Cache::Redis::Patcher does not eager load
157+
# ActiveSupport::Cache::RedisCacheStore when the version of Redis present is too old to be compatible.
158+
# @see Datadog::Tracing::Contrib::ActiveSupport::Cache::Redis::Patcher#patch_redis_cache_store?
159+
desc '' # "Explicitly hiding from `rake -T`"
160+
RSpec::Core::RakeTask.new(:rails_old_redis) do |t, args|
161+
t.pattern = 'spec/datadog/tracing/contrib/rails/cache_spec.rb'
162+
t.rspec_opts = args.to_a.join(' ')
163+
end
164+
156165
desc '' # "Explicitly hiding from `rake -T`"
157166
RSpec::Core::RakeTask.new(:hanami) do |t, args|
158167
t.pattern = 'spec/datadog/tracing/contrib/hanami/**/*_spec.rb'

Diff for: Steepfile

+40
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,48 @@
1+
# Declare shortcuts for Steep::Signature::Ruby to make this file easier to read
2+
# as well as facilitating the findability of violation types emitted by the CLI
3+
# (e.g. the CLI emits `Diagnostic ID: Ruby::UnknownConstant` when finding errors).
4+
Ruby = Steep::Diagnostic::Ruby
5+
16
target :datadog do
27
signature 'sig'
38

49
check 'lib/'
510

11+
# This makes Steep check the codebase with the strictest settings.
12+
# We are free to disable checks if needed inside the block.
13+
#
14+
# The default level is `Ruby.default`, and there's an even stricter level called `Ruby.all_error`.
15+
configure_code_diagnostics(Ruby.strict) do |hash|
16+
# These checks can be gradually enabled as the codebase cleans up.
17+
# The reporting levels are:
18+
# * `:error`, `:warning`: These will fail `rake typecheck` and are always reported by default.
19+
# * `:information`, `:hint`: To see these, run `rake 'typecheck[--severity-level=information]'`
20+
# or `rake 'typecheck[--severity-level=hint]'`
21+
22+
# These first checks are likely the easiest to fix, given they capture a mismatch
23+
# between the already declared type in `.rbs` and the actual type inferred by Steep.
24+
hash[Ruby::DifferentMethodParameterKind] = :information
25+
hash[Ruby::IncompatibleAssignment] = :information
26+
27+
# These checks are a bit harder, because they represent the lack of sufficient type information.
28+
hash[Ruby::FallbackAny] = :information
29+
hash[Ruby::UnknownInstanceVariable] = :information
30+
hash[Ruby::UnknownRecordKey] = :information
31+
32+
# This check asks you to type every empty collection used in
33+
# local variables with an inline type annotation (e.g. `ret = {} #: Hash[Symbol,untyped]`).
34+
# This pollutes the code base, and demands seemingly unnecessary typing of internal variables.
35+
# Ideally, these empty collections automatically assume a signature based on its usage inside its method.
36+
# @see https://github.com/soutaro/steep/pull/1338
37+
hash[Ruby::UnannotatedEmptyCollection] = :information
38+
39+
# This one is funny: it is raised whenever we use `super` from a method in a Module.
40+
# Since there's no guarantee that the module will be included in a class with the matching method,
41+
# Steep cannot know if the `super` call will be valid.
42+
# But this is very common in the codebase, as such module are used for monkey-patching.
43+
hash[Ruby::UnexpectedSuper] = :information
44+
end
45+
646
ignore 'lib/datadog/appsec.rb'
747
ignore 'lib/datadog/appsec/component.rb'
848
# Excluded due to https://github.com/soutaro/steep/issues/1232

Diff for: appraisal/generate.rb

+10-12
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,38 @@
1212
#
1313
# Usage: `bundle exec ruby appraisal/generate.rb`
1414

15+
require 'bundler'
1516
require "appraisal/appraisal"
1617

1718
require_relative "../tasks/appraisal_conversion"
1819

1920
gemfile = Appraisal::Gemfile.new.tap do |g|
2021
# Support `eval_gemfile` for `Bundler::DSL`
2122
g.define_singleton_method(:eval_gemfile) {|file| load(file) }
22-
g.load(ENV["BUNDLE_GEMFILE"] || "Gemfile")
23+
g.load(Bundler.default_gemfile)
2324
end
2425

2526
appraisals = []
2627

27-
REMOVED_GEMS = {
28-
:check => [
29-
'rbs',
30-
'steep',
31-
'standard',
32-
],
33-
:dev => [
34-
'ruby-lsp',
35-
],
36-
}
28+
definition = Bundler.definition
29+
to_remove = Hash.new { |hash, key| hash[key] = definition.dependencies_for([key]).map(&:name) }
30+
31+
# Register groups to be removed
32+
[:dev, :check].each { |g| to_remove[g] }
3733

3834
define_singleton_method(:appraise) do |name, &block|
3935
# Customize name
4036
name = "#{AppraisalConversion.runtime_identifier}_#{name}"
4137
appraisal = Appraisal::Appraisal.new(name, gemfile)
4238
appraisal.instance_eval(&block)
39+
4340
# Customize callback for removal
44-
REMOVED_GEMS.each do |group_name, gems|
41+
to_remove.each do |group_name, gems|
4542
appraisal.group(group_name) do
4643
gems.each { |gem_name| remove_gem gem_name }
4744
end
4845
end
46+
4947
appraisals << appraisal
5048
end
5149

Diff for: appraisal/jruby-9.2.rb

+10
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,16 @@
151151
gem 'i18n', '1.8.7', platform: :jruby # Removal pending: https://github.com/ruby-i18n/i18n/issues/555#issuecomment-772112169
152152
end
153153

154+
appraise 'rails-old-redis' do
155+
# All dependencies except Redis < 4 are not important, they are just required to run Rails tests.
156+
gem 'redis', '< 4'
157+
gem 'rails', '~> 6.1.0'
158+
gem 'activerecord-jdbcpostgresql-adapter', platform: :jruby
159+
gem 'sprockets', '< 4'
160+
gem 'lograge', '~> 0.11'
161+
gem 'net-smtp'
162+
end
163+
154164
appraise 'resque2-redis3' do
155165
gem 'redis', '< 4.0'
156166
gem 'resque', '>= 2.0'

Diff for: appraisal/jruby-9.3.rb

+10
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,16 @@
131131
gem 'rails_semantic_logger', '~> 4.0'
132132
end
133133

134+
appraise 'rails-old-redis' do
135+
# All dependencies except Redis < 4 are not important, they are just required to run Rails tests.
136+
gem 'redis', '< 4'
137+
gem 'rails', '~> 6.1.0'
138+
gem 'activerecord-jdbcpostgresql-adapter', platform: :jruby
139+
gem 'sprockets', '< 4'
140+
gem 'lograge', '~> 0.11'
141+
gem 'net-smtp'
142+
end
143+
134144
appraise 'resque2-redis3' do
135145
gem 'redis', '~> 3.0'
136146
gem 'resque', '>= 2.0'

0 commit comments

Comments
 (0)