Module: Rearview

Includes:
Logger
Defined in:
lib/rearview.rb,
lib/rearview/alerts.rb,
lib/rearview/engine.rb,
lib/rearview/logger.rb,
lib/rearview/sandbox.rb,
lib/rearview/version.rb,
app/models/rearview/job.rb,
lib/rearview/distribute.rb,
lib/rearview/uri_helper.rb,
app/models/rearview/user.rb,
lib/rearview/alerts/base.rb,
lib/rearview/cron_helper.rb,
lib/rearview/monitor_task.rb,
lib/rearview/configuration.rb,
lib/rearview/alerts_handler.rb,
lib/rearview/monitor_runner.rb,
app/models/rearview/job_data.rb,
lib/rearview/graphite_parser.rb,
lib/rearview/monitor_service.rb,
lib/rearview/results_handler.rb,
app/models/rearview/dashboard.rb,
app/models/rearview/job_error.rb,
lib/rearview/ext/state_machine.rb,
lib/rearview/alerts/email_alert.rb,
lib/rearview/monitor_supervisor.rb,
app/mailers/rearview/alert_mailer.rb,
lib/rearview/alerts/campfire_alert.rb,
lib/rearview/alerts/pagerduty_alert.rb,
lib/rearview/constants_module_maker.rb,
app/helpers/rearview/application_helper.rb,
app/controllers/rearview/home_controller.rb,
app/controllers/rearview/jobs_controller.rb,
app/controllers/rearview/user_controller.rb,
lib/generators/rearview/install_generator.rb,
app/controllers/rearview/monitor_controller.rb,
app/controllers/rearview/dashboards_controller.rb,
app/controllers/rearview/application_controller.rb,
app/controllers/rearview/dashboard_children_controller.rb

Defined Under Namespace

Modules: Alerts, ApplicationHelper, Concerns, ConstantsModuleMaker, CronHelper, Distribute, Ext, Generators, Logger, Sandbox Classes: AlertMailer, AlertsHandler, ApplicationController, Configuration, Dashboard, DashboardChildrenController, DashboardsController, Engine, GraphiteParser, HomeController, Job, JobData, JobError, JobsController, MonitorController, MonitorRunner, MonitorService, MonitorSupervisor, MonitorTask, ResultsHandler, UriHelper, User, UserController

Constant Summary collapse

VERSION =
"1.0.0"

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.alert_clientsObject

Returns the value of attribute alert_clients.



25
26
27
# File 'lib/rearview.rb', line 25

def alert_clients
  @alert_clients
end

.monitor_serviceObject

Returns the value of attribute monitor_service.



25
26
27
# File 'lib/rearview.rb', line 25

def monitor_service
  @monitor_service
end

Class Method Details

.boot!Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/rearview.rb', line 50

def boot!
  @logger = config.logger if(config.logger.present?)
  logger.info "[#{self}] booting..."
  logger.info "[#{self}] using configuration: \n#{config}"
  if config.verify?
    logger.info "[#{self}] verifying sandbox..."
    if Rearview::Sandbox.valid?
      logger.info "[#{self}] sandbox verified"
    else
      logger.error "[#{self}] sandbox verification FAILED"
    end
  end
  Celluloid.logger = @logger
  jobs = ( config.preload_jobs? ? Job.schedulable : [] )
  logger.info "[#{self}] starting up monitor service for (#{jobs.count}) job(s)"
  @monitor_service = Rearview::MonitorService.new(jobs)
  if config.monitor_enabled?
    @monitor_service.startup
  else
    logger.warn "[#{self}] monitor disabled"
  end
  @alert_clients = Rearview::Alerts.registry.values
  @booted = true
end

.booted?Boolean

Returns:



38
39
40
# File 'lib/rearview.rb', line 38

def booted?
  @booted
end

.configObject



46
47
48
# File 'lib/rearview.rb', line 46

def config
  @config ||= Rearview::Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



42
43
44
# File 'lib/rearview.rb', line 42

def configure
  yield config
end

.loggerObject



30
31
32
# File 'lib/rearview.rb', line 30

def logger
  @logger ||= Rails.logger
end

.logger=(logger) ⇒ Object



34
35
36
# File 'lib/rearview.rb', line 34

def logger=(logger)
  @logger = logger
end

Instance Method Details

#to_sObject



35
36
37
# File 'lib/rearview/results_handler.rb', line 35

def to_s
  "#{super.to_s} [jobId:#{@job.id} threadId:#{java.lang.Thread.currentThread.getId} threadName:#{java.lang.Thread.currentThread.getName}]"
end