Module: QueuePulse

Defined in:
lib/queue_pulse.rb,
lib/queue_pulse/alert.rb,
lib/queue_pulse/state.rb,
lib/queue_pulse/poller.rb,
lib/queue_pulse/source.rb,
lib/queue_pulse/monitor.rb,
lib/queue_pulse/railtie.rb,
lib/queue_pulse/version.rb,
lib/queue_pulse/check_job.rb,
lib/queue_pulse/checks/base.rb,
lib/queue_pulse/memory_store.rb,
lib/queue_pulse/configuration.rb,
lib/queue_pulse/notifiers/base.rb,
lib/queue_pulse/notifiers/test.rb,
lib/queue_pulse/checks/failures.rb,
lib/queue_pulse/notifiers/email.rb,
lib/queue_pulse/notifiers/slack.rb,
lib/queue_pulse/checks/stuck_jobs.rb,
lib/queue_pulse/notifiers/webhook.rb,
lib/queue_pulse/checks/queue_depth.rb,
lib/queue_pulse/source/solid_queue.rb,
lib/queue_pulse/checks/queue_latency.rb,
lib/queue_pulse/checks/worker_liveness.rb

Overview

QueuePulse — immediate alerting + metrics for Solid Queue.

Reads Solid Queue's existing tables (read-only, no migration) and notifies you the moment background jobs fail, stall, back up, or workers die.

Defined Under Namespace

Modules: Checks, Notifiers Classes: Alert, CheckJob, Configuration, Error, MemoryStore, Monitor, Poller, Railtie, Source, State

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.check!(source: nil) ⇒ Array<QueuePulse::Alert>

Run one full monitoring pass and deliver any alerts. Fully exception-isolated: never raises into the host app.

Parameters:

Returns:



62
63
64
65
66
67
68
69
# File 'lib/queue_pulse.rb', line 62

def check!(source: nil)
  return [] unless config.enabled

  Monitor.new(config: config, source: source).run
rescue StandardError => e
  logger.error("[QueuePulse] check! failed: #{e.class}: #{e.message}")
  []
end

.configObject



45
46
47
# File 'lib/queue_pulse.rb', line 45

def config
  @config ||= Configuration.new
end

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

Configure QueuePulse, typically from config/initializers/queue_pulse.rb

QueuePulse.configure do |config|
config.add_notifier QueuePulse::Notifiers::Slack.new(webhook_url: ENV["SLACK_WEBHOOK_URL"])
config.queue_latency_threshold = 120
end

Yields:



40
41
42
43
# File 'lib/queue_pulse.rb', line 40

def configure
  yield config if block_given?
  config
end

.loggerObject



53
54
55
# File 'lib/queue_pulse.rb', line 53

def logger
  config.logger
end

.reset_config!Object



49
50
51
# File 'lib/queue_pulse.rb', line 49

def reset_config!
  @config = Configuration.new
end

.start_poller!Object



43
44
45
46
# File 'lib/queue_pulse/poller.rb', line 43

def start_poller!
  @poller ||= Poller.new(config)
  @poller.start
end

.stop_poller!Object



48
49
50
# File 'lib/queue_pulse/poller.rb', line 48

def stop_poller!
  @poller&.stop
end