Module: Pigeon::Monitoring

Defined in:
lib/pigeon/monitoring.rb

Overview

Monitoring-related functionality for Pigeon

Class Method Summary collapse

Class Method Details

.health_statusHash

Get the overall health status



109
110
111
# File 'lib/pigeon/monitoring.rb', line 109

def self.health_status
  HealthCheck.status
end

.kafka_healthHash

Get the health status of Kafka connectivity



103
104
105
# File 'lib/pigeon/monitoring.rb', line 103

def self.kafka_health
  HealthCheck.kafka_health
end

.last_processing_runTime?

Get the time of the last processing run



58
59
60
# File 'lib/pigeon/monitoring.rb', line 58

def self.last_processing_run
  @last_processing_run
end

.last_processing_run=(time) ⇒ Time

Set the time of the last processing run



78
79
80
# File 'lib/pigeon/monitoring.rb', line 78

def self.last_processing_run=(time)
  @last_processing_run = time
end

.last_successful_processing_runTime?

Get the time of the last successful processing run



64
65
66
# File 'lib/pigeon/monitoring.rb', line 64

def self.last_successful_processing_run
  @last_successful_processing_run
end

.last_successful_processing_run=(time) ⇒ Time

Set the time of the last successful processing run



85
86
87
# File 'lib/pigeon/monitoring.rb', line 85

def self.last_successful_processing_run=(time)
  @last_successful_processing_run = time
end

.log_levelInteger

Get the current log level



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

def self.log_level
  Core.config.logger.level
end

.log_level=(level) ⇒ Integer

Set the log level



40
41
42
# File 'lib/pigeon/monitoring.rb', line 40

def self.log_level=(level)
  Core.config.logger.level = level
end

.logger_with_context(context = {}) ⇒ Pigeon::Logging::StructuredLogger

Create a logger with additional context



33
34
35
# File 'lib/pigeon/monitoring.rb', line 33

def self.logger_with_context(context = {})
  Core.config.logger.with_context(context)
end

.metricsHash

Get all metrics



14
15
16
# File 'lib/pigeon/monitoring.rb', line 14

def self.metrics
  metrics_collector.all_metrics
end

.metrics_collectorPigeon::Metrics::Collector

Get the metrics collector



8
9
10
# File 'lib/pigeon/monitoring.rb', line 8

def self.metrics_collector
  Core.config.metrics_collector ||= Pigeon::Metrics::Collector.new
end

.metrics_for_monitoringHash

Get metrics in a format suitable for monitoring systems



20
21
22
# File 'lib/pigeon/monitoring.rb', line 20

def self.metrics_for_monitoring
  metrics_collector.metrics_for_monitoring
end

.processor_healthHash

Get the health status of the processor



91
92
93
# File 'lib/pigeon/monitoring.rb', line 91

def self.processor_health
  HealthCheck.processor_health
end

.processor_start_timeTime?

Get the time when the processor was started



52
53
54
# File 'lib/pigeon/monitoring.rb', line 52

def self.processor_start_time
  @processor_start_time
end

.processor_start_time=(time) ⇒ Time

Set the processor start time



71
72
73
# File 'lib/pigeon/monitoring.rb', line 71

def self.processor_start_time=(time)
  @processor_start_time = time
end

.queue_healthHash

Get the health status of the queue



97
98
99
# File 'lib/pigeon/monitoring.rb', line 97

def self.queue_health
  HealthCheck.queue_health
end

.reset_metricsvoid

This method returns an undefined value.

Reset all metrics



26
27
28
# File 'lib/pigeon/monitoring.rb', line 26

def self.reset_metrics
  metrics_collector.reset
end