Module: SolidQueueGuard::Observability Private

Defined in:
lib/solid_queue_guard/observability.rb

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

Class Method Summary collapse

Class Method Details

.log_results(report) ⇒ Object

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.



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/solid_queue_guard/observability.rb', line 8

def log_results(report)
  return unless logger

  report.results.each do |result|
    message = "[SolidQueueGuard] #{result.status} check #{result.id}: #{result.message}"
    case result.status
    when :skip, :pass then logger.debug(message)
    when :warn then logger.warn(message)
    when :fail then logger.error(message)
    end
  end
end

.loggerObject

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.



31
32
33
# File 'lib/solid_queue_guard/observability.rb', line 31

def logger
  defined?(Rails) && Rails.logger
end

.notify_status_change(report, previous_status: nil) ⇒ Object

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.



21
22
23
24
25
26
27
28
29
# File 'lib/solid_queue_guard/observability.rb', line 21

def notify_status_change(report, previous_status: nil)
  callback = SolidQueueGuard.config.on_status_change
  return unless callback.respond_to?(:call)

  current_status = report.status
  return if previous_status == current_status

  callback.call(previous_status, current_status, report)
end