Skip to content

Commit

Permalink
Merge branch 'main' into release/multi/20241119162613
Browse files Browse the repository at this point in the history
  • Loading branch information
arielvalentin authored Nov 19, 2024
2 parents b97a4e0 + 37584d0 commit 426748a
Show file tree
Hide file tree
Showing 21 changed files with 114 additions and 108 deletions.
1 change: 1 addition & 0 deletions .github/actions/test_gem/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ runs:
run: |
# 💎 Install dependencies and generate appraisals 💎
bundle install --quiet --jobs=3 --retry=4
bundle exec appraisal clean
bundle exec appraisal generate
working-directory: "${{ steps.setup.outputs.gem_dir }}"

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

# Appraisals
instrumentation/**/gemfiles
instrumentation/**/tmp/**/*

# Sqlite file for tests
instrumentation/active_record/db
Expand All @@ -26,3 +27,4 @@ instrumentation/active_record/db
.ruby-version

tags
!**/*/.gitkeep
24 changes: 12 additions & 12 deletions instrumentation/action_mailer/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
#
# SPDX-License-Identifier: Apache-2.0

appraise 'rails-6.1' do
gem 'rails', '~> 6.1.0'
end

appraise 'rails-7.0' do
gem 'rails', '~> 7.0.0'
end

appraise 'rails-7.1' do
gem 'rails', '~> 7.1.0'
%w[6.1.0 7.0.0 7.1.0].each do |version|
appraise "action_mailer-#{version}" do
gem 'rails', "~> #{version}"
end
end

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0')
appraise 'rails-7.2' do
gem 'rails', '~> 7.2.0'
%w[7.2.0].each do |version|
appraise "action_mailer-#{version}" do
gem 'rails', "~> #{version}"
end
end

appraise 'action_mailer-latest' do
gem 'rails'
end
end
24 changes: 12 additions & 12 deletions instrumentation/action_pack/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
#
# SPDX-License-Identifier: Apache-2.0

appraise 'rails-6.1' do
gem 'rails', '~> 6.1.0'
end

appraise 'rails-7.0' do
gem 'rails', '~> 7.0.0'
end

appraise 'rails-7.1' do
gem 'rails', '~> 7.1.0'
%w[6.1.0 7.0.0 7.1.0].each do |version|
appraise "rails-#{version}" do
gem 'rails', "~> #{version}"
end
end

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0')
appraise 'rails-7.2' do
gem 'rails', '~> 7.2.0'
%w[7.2.0].each do |version|
appraise "rails-#{version}" do
gem 'rails', "~> #{version}"
end
end

appraise 'rails-latest' do
gem 'rails'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
let(:exporter) { EXPORTER }
let(:spans) { exporter.finished_spans }
let(:span) { exporter.finished_spans.last }
let(:rails_app) { DEFAULT_RAILS_APP }
let(:rails_app) { AppConfig.initialize_app }
let(:config) { {} }

# Clear captured spans
Expand Down
5 changes: 0 additions & 5 deletions instrumentation/action_pack/test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,3 @@
c.use 'OpenTelemetry::Instrumentation::ActionPack'
c.add_span_processor span_processor
end

# Create a globally available Rails app, this should be used in test unless
# specifically testing behaviour with different initialization configs.
DEFAULT_RAILS_APP = AppConfig.initialize_app
Rails.application = DEFAULT_RAILS_APP
4 changes: 2 additions & 2 deletions instrumentation/action_pack/test/test_helpers/app_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#
# SPDX-License-Identifier: Apache-2.0

class Application < Rails::Application; end
require 'action_controller/railtie'
class Application < Rails::Application; end
require_relative 'middlewares'
require_relative 'controllers'
require_relative 'routes'
Expand All @@ -30,7 +30,7 @@ def initialize_app(use_exceptions_app: false, remove_rack_tracer_middleware: fal
case Rails.version
when /^6\.1/
apply_rails_6_1_configs(new_app)
when /^7\./
when /^7|8\./
apply_rails_7_configs(new_app)
end

Expand Down
24 changes: 12 additions & 12 deletions instrumentation/action_view/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
#
# SPDX-License-Identifier: Apache-2.0

appraise 'rails-6.1' do
gem 'rails', '~> 6.1.0'
end

appraise 'rails-7.0' do
gem 'rails', '~> 7.0.0'
end

appraise 'rails-7.1' do
gem 'rails', '~> 7.1.0'
%w[6.1.0 7.0.0 7.1.0].each do |version|
appraise "action_view-#{version}" do
gem 'rails', "~> #{version}"
end
end

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0')
appraise 'rails-7.2' do
gem 'rails', '~> 7.2.0'
%w[7.2.0].each do |version|
appraise "rails-#{version}" do
gem 'rails', "~> #{version}"
end
end

appraise 'rails-latest' do
gem 'rails'
end
end
12 changes: 10 additions & 2 deletions instrumentation/active_job/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
end
end

appraise 'activejob-latest' do
gem 'activejob'
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0')
%w[7.2.0].each do |version|
appraise "activejob-#{version}" do
gem 'activejob', "~> #{version}"
end
end

appraise 'activejob-latest' do
gem 'activejob'
end
end
27 changes: 15 additions & 12 deletions instrumentation/active_record/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@
#
# SPDX-License-Identifier: Apache-2.0

appraise 'activerecord-6.1' do
gem 'activerecord', '~> 6.1.0'
end

appraise 'activerecord-7.0' do
gem 'activerecord', '~> 7.0.0'
end

appraise 'activerecord-7.1' do
gem 'activerecord', '~> 7.1.0'
%w[6.1.0 7.0.0 7.1.0].each do |version|
appraise "activerecord-#{version}" do
gem 'sqlite3', '~> 1.4'
gem 'activerecord', "~> #{version}"
end
end

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0')
appraise 'activerecord-7.2' do
gem 'activerecord', '~> 7.2.0'
%w[7.2.0].each do |version|
appraise "activerecord-#{version}" do
gem 'sqlite3', '~> 1.4'
gem 'activerecord', "~> #{version}"
end
end

appraise 'activerecord-latest' do
gem 'sqlite3', '>= 2.1'
gem 'activerecord'
end
end
1 change: 0 additions & 1 deletion instrumentation/active_record/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ group :test do
gem 'byebug'
gem 'opentelemetry-instrumentation-base', path: '../base'
gem 'pry-byebug'
gem 'sqlite3', '~> 1.4'
end
24 changes: 12 additions & 12 deletions instrumentation/active_support/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
#
# SPDX-License-Identifier: Apache-2.0

appraise 'activesupport-6.1' do
gem 'activesupport', '~> 6.1.0'
end

appraise 'activesupport-7.0' do
gem 'activesupport', '~> 7.0.0'
end

appraise 'activesupport-7.1' do
gem 'activesupport', '~> 7.1.0'
%w[6.1.0 7.0.0 7.1.0].each do |version|
appraise "activesupport-#{version}" do
gem 'activesupport', "~> #{version}"
end
end

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0')
appraise 'activesupport-7.2' do
gem 'activesupport', '~> 7.2.0'
%w[7.2.0].each do |version|
appraise "activesupport-#{version}" do
gem 'activesupport', "~> #{version}"
end
end

appraise 'activesupport-latest' do
gem 'activesupport'
end
end
27 changes: 16 additions & 11 deletions instrumentation/delayed_job/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@
#
# SPDX-License-Identifier: Apache-2.0

appraise 'delayed_job_4.1-rails-latest' do
gem 'activejob'
%w[6.1.0 7.0.0 7.1.0].each do |version|
appraise "delayed_job_4.1-activejob-#{version}" do
gem 'delayed_job', '~> 4.1'
gem 'activejob', "~> #{version}"
end
end

appraise 'delayed_job_4.1-rails-7.1' do
gem 'activejob', '~> 7.1.0'
end

appraise 'delayed_job_4.1-rails-7.0' do
gem 'activejob', '~> 7.0.0'
end
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0')
%w[7.2.0].each do |version|
appraise "delayed_job-4.1-activejob-#{version}" do
gem 'delayed_job', '~> 4.1'
gem 'activejob', "~> #{version}"
end
end

appraise 'delayed_job-4.1-rails-6.1' do
gem 'activejob', '~> 6.1.0'
appraise 'delayed_job-latest' do
gem 'delayed_job'
gem 'activejob'
end
end
1 change: 0 additions & 1 deletion instrumentation/delayed_job/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ source 'https://rubygems.org'
gemspec

group :test do
gem 'delayed_job', '~> 4.1'
gem 'opentelemetry-instrumentation-base', path: '../base'
end
24 changes: 12 additions & 12 deletions instrumentation/rails/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
#
# SPDX-License-Identifier: Apache-2.0

appraise 'rails-6.1' do
gem 'rails', '~> 6.1.0'
end

appraise 'rails-7.0' do
gem 'rails', '~> 7.0.0'
end

appraise 'rails-7.1' do
gem 'rails', '~> 7.1.0'
%w[6.1.0 7.0.0 7.1.0].each do |version|
appraise "rails-#{version}" do
gem 'rails', "~> #{version}"
end
end

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0')
appraise 'rails-7.2' do
gem 'rails', '~> 7.2.0'
%w[7.2.0].each do |version|
appraise "rails-#{version}" do
gem 'rails', "~> #{version}"
end
end

appraise 'rails-latest' do
gem 'rails'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
let(:exporter) { EXPORTER }
let(:spans) { exporter.finished_spans }
let(:span) { exporter.finished_spans.last }
let(:rails_app) { DEFAULT_RAILS_APP }
let(:rails_app) { AppConfig.initialize_app }

# Clear captured spans
before { exporter.reset }
Expand Down
5 changes: 0 additions & 5 deletions instrumentation/rails/test/instrumentation/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,3 @@
c.use_all
c.add_span_processor span_processor
end

# Create a globally available Rails app, this should be used in test unless
# specifically testing behaviour with different initialization configs.
DEFAULT_RAILS_APP = AppConfig.initialize_app
Rails.application = DEFAULT_RAILS_APP
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
#
# SPDX-License-Identifier: Apache-2.0

class Application < Rails::Application; end
require 'action_controller/railtie'
class Application < Rails::Application; end

require_relative 'middlewares'
require_relative 'controllers'
require_relative 'routes'
Expand All @@ -28,7 +29,7 @@ def initialize_app(use_exceptions_app: false, remove_rack_tracer_middleware: fal
case Rails.version
when /^6\.1/
apply_rails_6_1_configs(new_app)
when /^7\./
when /^7|8\./
apply_rails_7_configs(new_app)
end

Expand All @@ -46,9 +47,7 @@ def initialize_app(use_exceptions_app: false, remove_rack_tracer_middleware: fal
private

def remove_rack_middleware(application)
application.middleware.delete(
OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware
)
application.middleware.delete(Rack::Events)
end

def add_exceptions_app(application)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ def ok
end

def internal_server_error
raise :internal_server_error
raise 'internal_server_error'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def draw_routes(rails_app)
rails_app.routes.draw do
get '/ok', to: 'example#ok'
get 'ok', to: 'example#ok'
get '/internal_server_error', to: 'example#internal_server_error'
end
end
Empty file.

0 comments on commit 426748a

Please sign in to comment.