Skip to content

Commit

Permalink
fix: Only use application_name if @Application is set
Browse files Browse the repository at this point in the history
Signed-off-by: Ferenc Géczi <[email protected]>
  • Loading branch information
Ferenc- committed Mar 19, 2024
1 parent e0db23e commit 842e340
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/instana/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,17 @@ def get_app_name
end
end

if defined?(::RailsLts) && ::Rails.respond_to?(:application_name)
return ::RailsLts.application_name
elsif defined?(::Rails) && ::Rails.respond_to?(:application_name)
return ::Rails.application_name
rails_module = if defined?(::RailsLts)
then ::RailsLts
elsif defined?(::Rails)
then ::Rails
end

if rails_module &&
rails_module.respond_to?(:application_name) &&
rails_module.instance_variables.include?(:@application) &&
rails_module.application
return rails_module.application_name
end

if $0.to_s.empty?
Expand Down

0 comments on commit 842e340

Please sign in to comment.