Skip to content

Commit

Permalink
squash: remove global vars
Browse files Browse the repository at this point in the history
  • Loading branch information
arielvalentin committed Nov 19, 2024
1 parent ee4690a commit 5f0c121
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 12 deletions.
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
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 Down Expand Up @@ -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 5f0c121

Please sign in to comment.