Class: Appsignal::CLI::Demo Private

Inherits:
Object show all
Defined in:
lib/appsignal/cli/demo.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Command line tool for sending demonstration samples to AppSignal.com

This command line tool is useful when testing AppSignal on a system and validating the local configuration. It tests if the installation of AppSignal has succeeded and if the AppSignal agent is able to run on the machine's architecture and communicate with the AppSignal servers.

The same test is also run during installation with Install.

Exit codes

  • Exits with status code 0 if the demo command has finished.
  • Exits with status code 1 if the demo command failed to finished.

Examples:

On the command line in your project

appsignal demo

With a specific environment

appsignal demo --environment=production

Standalone run

gem install appsignal
export APPSIGNAL_APP_NAME="My test app"
export APPSIGNAL_APP_ENV="test"
export APPSIGNAL_PUSH_API_KEY="xxxx-xxxx-xxxx-xxxx"
appsignal demo

See Also:

Since:

  • 2.0.0

Class Method Summary collapse

Class Method Details

.run(options = {}) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :environment (String)

    environment to load configuration for.

Since:

  • 2.0.0



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/appsignal/cli/demo.rb', line 49

def run(options = {})
  ENV["APPSIGNAL_APP_ENV"] = options[:environment] if options[:environment]

  puts "Sending demonstration sample data..."
  if Appsignal::Demo.transmit
    puts "Demonstration sample data sent!"
    puts "It may take about a minute for the data to appear on https://appsignal.com/accounts"
  else
    puts "\nError: Unable to start the AppSignal agent and send data to AppSignal.com."
    puts "Please use the diagnose command (https://docs.appsignal.com/ruby/command-line/diagnose.html) to debug your configuration:"
    puts
    puts "    bundle exec appsignal diagnose --environment=production"
    puts
    exit 1
  end
end