Sha256: 6c34afea8662910880bc7431764f0f0f0422813da93722a7c2278969707c7f38

Contents?: true

Size: 1.98 KB

Versions: 37

Compression:

Stored size: 1.98 KB

Contents

require 'appsignal'

namespace :appsignal do
  namespace :diag do

    desc "Shows the AppSignal gem version"
    task :gem_version do
      puts "Gem version: #{Appsignal::VERSION}"
    end

    desc "Shows the agent version"
    task :agent_version do
      puts "Agent version: #{Appsignal::Extension.agent_version}"
    end

    desc "Attempt to start appsignal"
    task :start_appsignal do
      Appsignal.start
    end

    desc "Checks if config is present and shows the values"
    task :config => :start_appsignal do
      Appsignal.config.config_hash.each do |key, val|
        puts "Config #{key}: #{val}"
      end
    end

    desc "Checks if required paths are writeable"
    task :paths_writable => :start_appsignal do
      possible_paths = [
        Appsignal.config.root_path,
        Appsignal.config.log_file_path
      ]

      puts "Checking if required paths are writable:"
      possible_paths.each do |path|
        result = File.writable?(path) ? 'Ok' : 'Failed'
        puts "#{path} ...#{result}"
      end
      puts "\n"
    end

    desc "Check if API key is valid"
    task :check_api_key => :start_appsignal do
      auth_check = ::Appsignal::AuthCheck.new(Appsignal.config, Appsignal.logger)
      status, result = auth_check.perform_with_result
      if status == '200'
        puts "Checking API key: Ok"
      else
        puts "Checking API key: Failed"
      end
    end

    desc "Check the ext installation log"
    task :check_ext_install do
      require 'bundler/cli'
      require "bundler/cli/common"
      path     = Bundler::CLI::Common.select_spec('appsignal').full_gem_path
      log_path = "#{path.strip}/ext/install.log"
      puts "Showing last lines of extension install log: #{log_path}"
      puts File.read(log_path)
      puts "\n"
    end

    task :run => [
      "diag:gem_version",
      "diag:agent_version",
      "diag:start_appsignal",
      "diag:config",
      "diag:check_api_key",
      "diag:paths_writable",
      "diag:check_ext_install"
    ]
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
appsignal-1.1.9.beta.1 lib/tasks/diag.rake
appsignal-1.1.8 lib/tasks/diag.rake
appsignal-1.2.0.alpha.3 lib/tasks/diag.rake
appsignal-1.1.7 lib/tasks/diag.rake
appsignal-1.2.0.alpha.2 lib/tasks/diag.rake
appsignal-1.1.7.beta.2 lib/tasks/diag.rake
appsignal-1.2.0.alpha.1 lib/tasks/diag.rake
appsignal-1.1.7.beta.1 lib/tasks/diag.rake
appsignal-1.1.6 lib/tasks/diag.rake
appsignal-1.1.6.beta.1 lib/tasks/diag.rake
appsignal-1.1.5 lib/tasks/diag.rake
appsignal-1.1.5.beta.4 lib/tasks/diag.rake
appsignal-1.1.5.beta.3 lib/tasks/diag.rake
appsignal-1.1.5.beta.2 lib/tasks/diag.rake
appsignal-1.1.5.beta.1 lib/tasks/diag.rake
appsignal-1.1.4 lib/tasks/diag.rake
appsignal-1.1.4.beta.3 lib/tasks/diag.rake
appsignal-1.1.4.beta.2 lib/tasks/diag.rake
appsignal-1.1.4.beta.1 lib/tasks/diag.rake
appsignal-1.1.3 lib/tasks/diag.rake