Skip to content

Commit

Permalink
test railtie
Browse files Browse the repository at this point in the history
  • Loading branch information
KapustaB committed Mar 24, 2024
1 parent 93c2d32 commit 5290794
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/treblle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'treblle/middleware'
require 'treblle/configuration'
require 'treblle/rails/treblle_railtie'
require_relative 'treblle/railtie' if defined?(Rails::Railtie)

# Treblle middleware for request interception and gathering.
module Treblle
Expand Down
3 changes: 1 addition & 2 deletions lib/treblle/rails/capture_exceptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ def call(env)
response = @app.call(env)
status, _headers, _rack_response = response

handle_monitoring(env, response, started_at)
handle_monitoring(env, response, started_at) if status >= 400 && env["action_dispatch.exception"]
handle_monitoring(env, response, started_at) if status >= 400

response
end
Expand Down
13 changes: 0 additions & 13 deletions lib/treblle/rails/railtie.rb

This file was deleted.

12 changes: 12 additions & 0 deletions lib/treblle/railtie.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'treblle/rails/capture_exceptions'
require 'treblle'

module Treblle
class Railtie < ::Rails::Railtie
initializer 'treblle.install_middleware' do |app|
puts("debug::" + "install_middleware #{app.inspect}")
puts("*" * 100)
app.config.middleware.insert_after ActionDispatch::ShowExceptions, Treblle::Rails::CaptureExceptions
end
end
end

0 comments on commit 5290794

Please sign in to comment.