Skip to content

Commit

Permalink
Merge branch 'master' into span-events-writer
Browse files Browse the repository at this point in the history
  • Loading branch information
marcotc authored Jan 23, 2025
2 parents 148f1b0 + 84ca739 commit 00b5858
Show file tree
Hide file tree
Showing 658 changed files with 7,215 additions and 1,769 deletions.
44 changes: 11 additions & 33 deletions .github/scripts/find_gem_version_bounds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -37,32 +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"
if unspecified
puts "#{gem_name} uses latest"
end
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)
Expand All @@ -86,7 +67,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]))
Expand All @@ -102,6 +82,7 @@ def version_valid?(version, unspecified)
Gem::Version.new(version)
true
rescue ArgumentError
puts "#{version} is invalid format."
false
end

Expand All @@ -125,18 +106,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

Expand All @@ -152,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
Expand Down
4 changes: 0 additions & 4 deletions .github/scripts/generate_table_versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ext/**/skipped_reason.txt
# lock files
Gemfile.lock
Gemfile-*.lock
*.gemfile.lock
/*.gemfile.lock

# bundle config
gemfiles/.bundle
Expand Down
2 changes: 2 additions & 0 deletions .gitlab/install_datadog_deps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@
'DD_PROFILING_NO_EXTENSION' => 'true',
}

# ADD NEW DEPENDENCIES HERE
[
'datadog-ruby_core_source',
'ffi',
'libddwaf',
'msgpack',
'libdatadog', # libdatadog MUST be installed before datadog to ensure libdatadog native extension is compiled
'logger',
'datadog',
].each do |gem|
version = gem_version_mapping.delete(gem)
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/scripts/vaccine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

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

# Trigger workflow
Expand Down
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@ Lint/UnusedBlockArgument:
Style/TrailingCommaInArguments:
Enabled: false

Style/TrailingUnderscoreVariable:
Enabled: false

Style/TrailingCommaInArrayLiteral:
Enabled: false

Expand Down
37 changes: 36 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

## [Unreleased]

## [2.9.0] - 2025-01-15

### Added

* Core: add support for Ruby 3.4 ([#4249][])
* Integrations: add a new option for `ActiveSupport` to disable adding the `cache_key` as a Span Tag with the `cache_key_enabled` option ([#4022][])

### Changed

* Dynamic instrumentation: move DI preloading to `datadog/di/preload` ([#4288][])
* Dynamic instrumentation: dd-trace-rb now reports whether dynamic instrumentation is enabled in startup summary report ([#4285][])
* Dynamic instrumentation: improve loading of DI components ([#4272][], [#4239][])
* Dynamic instrumentation: logging of internal conditions is now done on debug level ([#4266][])
* Dynamic instrumentation: report instrumentation error for line probes when the target file is loaded but not in code tracker registry ([#4208][])
* Profiling: require datadog-ruby_core_source >= 3.3.7 to ensure Ruby 3.4 support ([#4228][])

### Fixed

* Core: fix a crash in crashtracker when agent hostname is an IPv6 address ([#4237][])
* Profiling: fix allocation profiling + otel tracing causing Ruby crash ([#4240][])
* Profiling: fix profiling warnings being really hard to silence ([#4232][])

## [2.8.0] - 2024-12-10

### Added
Expand Down Expand Up @@ -3057,7 +3079,8 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v2.8.0...master
[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v2.9.0...master
[2.9.0]: https://github.com/DataDog/dd-trace-rb/compare/v2.8.0...v2.9.0
[2.8.0]: https://github.com/DataDog/dd-trace-rb/compare/v2.7.1...v2.8.0
[2.7.0]: https://github.com/DataDog/dd-trace-rb/compare/v2.6.0...v2.7.0
[2.6.0]: https://github.com/DataDog/dd-trace-rb/compare/v2.5.0...v2.6.0
Expand Down Expand Up @@ -4499,6 +4522,7 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
[#3997]: https://github.com/DataDog/dd-trace-rb/issues/3997
[#4014]: https://github.com/DataDog/dd-trace-rb/issues/4014
[#4020]: https://github.com/DataDog/dd-trace-rb/issues/4020
[#4022]: https://github.com/DataDog/dd-trace-rb/issues/4022
[#4024]: https://github.com/DataDog/dd-trace-rb/issues/4024
[#4027]: https://github.com/DataDog/dd-trace-rb/issues/4027
[#4033]: https://github.com/DataDog/dd-trace-rb/issues/4033
Expand All @@ -4519,6 +4543,17 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
[#4195]: https://github.com/DataDog/dd-trace-rb/issues/4195
[#4196]: https://github.com/DataDog/dd-trace-rb/issues/4196
[#4197]: https://github.com/DataDog/dd-trace-rb/issues/4197
[#4208]: https://github.com/DataDog/dd-trace-rb/issues/4208
[#4228]: https://github.com/DataDog/dd-trace-rb/issues/4228
[#4232]: https://github.com/DataDog/dd-trace-rb/issues/4232
[#4237]: https://github.com/DataDog/dd-trace-rb/issues/4237
[#4239]: https://github.com/DataDog/dd-trace-rb/issues/4239
[#4240]: https://github.com/DataDog/dd-trace-rb/issues/4240
[#4249]: https://github.com/DataDog/dd-trace-rb/issues/4249
[#4266]: https://github.com/DataDog/dd-trace-rb/issues/4266
[#4272]: https://github.com/DataDog/dd-trace-rb/issues/4272
[#4285]: https://github.com/DataDog/dd-trace-rb/issues/4285
[#4288]: https://github.com/DataDog/dd-trace-rb/issues/4288
[@AdrianLC]: https://github.com/AdrianLC
[@Azure7111]: https://github.com/Azure7111
[@BabyGroot]: https://github.com/BabyGroot
Expand Down
3 changes: 3 additions & 0 deletions Matrixfile
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@
# Non-deprecated form of Regexp.new does not backport to Rack 1.x, see: https://github.com/rack/rack/pull/1998
'rack-1' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ❌ 3.3 / ❌ 3.4 / ✅ jruby',
},
'appsec:integration' => {
'rack-activerecord' => '❌ 2.5 / ❌ 2.6 / ❌ 2.7 / ❌ 3.0 / ❌ 3.1 / ❌ 3.2 / ✅ 3.3 / ❌ 3.4 / ❌ jruby',
},
'appsec:sinatra' => {
'sinatra-2' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'sinatra-3' => '❌ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
Expand Down
9 changes: 8 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ namespace :spec do
end

namespace :appsec do
task all: [:main, :active_record, :rack, :rails, :sinatra, :devise, :graphql]
task all: [:main, :active_record, :rack, :rails, :sinatra, :devise, :graphql, :integration]

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

# Datadog AppSec integration specs
desc '' # "Explicitly hiding from `rake -T`"
RSpec::Core::RakeTask.new(:integration) do |t, args|
t.pattern = 'spec/datadog/appsec/contrib/integration/**/*_spec.rb'
t.rspec_opts = args.to_a.join(' ')
end

# Datadog AppSec integrations
[
:active_record,
Expand Down
8 changes: 8 additions & 0 deletions appraisal/ruby-3.3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,11 @@
appraise 'core-old' do
gem 'dogstatsd-ruby', '~> 4'
end

appraise 'rack-activerecord' do
gem "rack", "~> 2"
gem 'rack-contrib'
gem 'rack-test' # Dev dependencies for testing rack-based code
gem "activerecord", "~> 7"
gem "sqlite3", ">= 1.4.2", platform: :ruby
end
10 changes: 10 additions & 0 deletions datadog.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ Gem::Specification.new do |spec|
# (and yes we have a test for it)
spec.add_dependency 'libdatadog', '~> 14.3.1.1.0'

# Will no longer be a default gem on Ruby 3.5, see
# https://github.com/ruby/ruby/commit/d7e558e3c48c213d0e8bedca4fb547db55613f7c and
# https://stdgems.org/ .
# We support all versions of this gem and don't particularly require any version restriction.
spec.add_dependency 'logger'

# Tip: When adding or removing dependencies, search the codebase for the string
# ADD NEW DEPENDENCIES HERE
# to find out a few more places that need to be kept in-sync.

spec.extensions = [
'ext/datadog_profiling_native_extension/extconf.rb',
'ext/datadog_profiling_loader/extconf.rb',
Expand Down
Loading

0 comments on commit 00b5858

Please sign in to comment.