Class: ScoutApm::Tasks::Doctor
- Inherits:
-
Object
- Object
- ScoutApm::Tasks::Doctor
- Defined in:
- lib/scout_apm/tasks/doctor.rb
Class Method Summary collapse
Instance Method Summary collapse
- #agent_context ⇒ Object
- #configuration_settings ⇒ Object
-
#initialize ⇒ Doctor
constructor
A new instance of Doctor.
- #installed_instruments ⇒ Object
- #log_details ⇒ Object
- #run! ⇒ Object
Constructor Details
#initialize ⇒ Doctor
Returns a new instance of Doctor.
8 9 |
# File 'lib/scout_apm/tasks/doctor.rb', line 8 def initialize() end |
Class Method Details
.run! ⇒ Object
4 5 6 |
# File 'lib/scout_apm/tasks/doctor.rb', line 4 def self.run! new.run! end |
Instance Method Details
#agent_context ⇒ Object
37 38 39 |
# File 'lib/scout_apm/tasks/doctor.rb', line 37 def agent_context ScoutApm::Agent.instance.context end |
#configuration_settings ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/scout_apm/tasks/doctor.rb', line 50 def configuration_settings all_settings = agent_context.config.all_settings longest_key = all_settings. map{|setting| setting[:key] }. inject(0) { |len, key| key.length > len ? key.length : len } format_string = "%12s | %-#{longest_key}s | %s" all_settings. map{|setting| sprintf format_string, setting[:source], setting[:key], setting[:value]}. join("\n") end |
#installed_instruments ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/scout_apm/tasks/doctor.rb', line 41 def installed_instruments ScoutApm::Agent. instance. instrument_manager. installed_instruments. map{|instance| "#{instance.installed? ? "Installed " : "Not Installed"} - #{instance.class.to_s}"}. join("\n") end |
#log_details ⇒ Object
64 65 66 67 68 69 70 71 72 |
# File 'lib/scout_apm/tasks/doctor.rb', line 64 def log_details if agent_context.logger.log_destination == STDOUT "STDOUT" elsif agent_context.logger.log_destination == STDERR "STDERR" else "#{agent_context.logger.log_file_path}" end end |
#run! ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/scout_apm/tasks/doctor.rb', line 11 def run! puts "Scout Doctor" puts "============" puts puts "Detected App Server: #{agent_context.environment.app_server_integration.name}" # puts "Detected Background Job: #{agent_context.environment.background_job_integration.name}" puts puts "Instruments:" puts "----------------------------------------" puts installed_instruments puts puts puts "Configuration Settings:" puts "-------------|------------------------------|-------" puts " From | Key | Value " puts "-------------|------------------------------|-------" puts configuration_settings puts puts puts "Misc:" puts "---------------" puts "Layaway Files stored at: #{agent_context.layaway.directory}" puts "Logs stored at: #{log_details}" end |