lib/instana/util.rb in instana-1.7.13 vs lib/instana/util.rb in instana-1.7.14a
- old
+ new
@@ -48,24 +48,28 @@
# Only valid for development or test environments
#env = ENV['RACK_ENV'] || ENV['RAILS_ENV']
#return unless %w(development, test).include? env
if RUBY_VERSION > '1.8.7'
- require 'pry-byebug'
+ begin
+ require 'pry-byebug'
- if defined?(PryByebug)
- Pry.commands.alias_command 'c', 'continue'
- Pry.commands.alias_command 's', 'step'
- Pry.commands.alias_command 'n', 'next'
- Pry.commands.alias_command 'f', 'finish'
+ if defined?(PryByebug)
+ Pry.commands.alias_command 'c', 'continue'
+ Pry.commands.alias_command 's', 'step'
+ Pry.commands.alias_command 'n', 'next'
+ Pry.commands.alias_command 'f', 'finish'
- Pry::Commands.command(/^$/, 'repeat last command') do
- _pry_.run_command Pry.history.to_a.last
+ Pry::Commands.command(/^$/, 'repeat last command') do
+ _pry_.run_command Pry.history.to_a.last
+ end
end
- end
- binding.pry
+ binding.pry
+ rescue LoadError
+ ::Instana.logger.warn("No debugger in bundle. Couldn't load pry-byebug.")
+ end
else
require 'ruby-debug'; debugger
end
end
@@ -154,9 +158,26 @@
process[:pid] = Process.pid
# This is usually Process.pid but in the case of containers, the host agent
# will return to us the true host pid in which we use to report data.
process[:report_pid] = nil
process
+ end
+
+ # Best effort to determine a name for the instrumented application
+ # on the dashboard.
+ #
+ def get_app_name
+ name = File.basename($0)
+
+ # Framework Detection
+ if defined?(::RailsLts) || defined?(::Rails)
+ name = Rails.application.class.to_s.split('::')[0]
+ end
+
+ return name
+ rescue Exception => e
+ Instana.logger.info "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}"
+ Instana.logger.debug e.backtrace.join("\r\n")
end
# Get the current time in milliseconds from the epoch
#
# @return [Integer] the current time in milliseconds