File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -22,16 +22,24 @@ def patch
2222 require_relative 'middlewares'
2323 @patched = true
2424
25- return unless get_option ( :middleware_names )
26-
27- top = get_option ( :application ) || rails_app
28- retain_middleware_name ( top )
25+ enable_middleware_names if get_option ( :middleware_names )
2926 end
3027
3128 def patched?
3229 @patched ||= false
3330 end
3431
32+ def enable_middleware_names
33+ root = get_option ( :application ) || rails_app
34+ retain_middleware_name ( root )
35+ rescue => e
36+ # We can safely ignore these exceptions since they happen only in the
37+ # context of middleware patching outside a Rails server process (eg. a
38+ # process that doesn't serve HTTP requests but has Rails environment
39+ # loaded such as a Resque master process)
40+ Tracer . log . debug ( "Error patching middleware stack: #{ e } " )
41+ end
42+
3543 def rails_app
3644 return unless Datadog . registry [ :rails ] . compatible?
3745 ::Rails . application . app
You can’t perform that action at this time.
0 commit comments