Module: Pigeon::HealthCheck
- Defined in:
- lib/pigeon/health_check.rb,
lib/pigeon/health_check/kafka.rb,
lib/pigeon/health_check/queue.rb,
lib/pigeon/health_check/processor.rb
Overview
Health check module for Pigeon
Defined Under Namespace
Modules: Kafka, Processor, Queue
Class Method Summary collapse
-
.determine_overall_status(components) ⇒ String
Determine the overall status based on component statuses.
-
.kafka_health ⇒ Hash
Check the health of Kafka connectivity.
-
.processor_health ⇒ Hash
Check the health of the processor.
-
.queue_health ⇒ Hash
Check the health of the queue.
-
.status ⇒ Hash
Get overall health status.
Class Method Details
.determine_overall_status(components) ⇒ String
Determine the overall status based on component statuses
53 54 55 56 57 58 59 60 61 |
# File 'lib/pigeon/health_check.rb', line 53 def self.determine_overall_status(components) if components.any? { |c| c[:status] == "critical" } "critical" elsif components.any? { |c| c[:status] == "warning" } "warning" else "healthy" end end |
.kafka_health ⇒ Hash
Check the health of Kafka connectivity
24 25 26 |
# File 'lib/pigeon/health_check.rb', line 24 def self.kafka_health Kafka.health end |
.processor_health ⇒ Hash
Check the health of the processor
12 13 14 |
# File 'lib/pigeon/health_check.rb', line 12 def self.processor_health Processor.health end |
.queue_health ⇒ Hash
Check the health of the queue
18 19 20 |
# File 'lib/pigeon/health_check.rb', line 18 def self.queue_health Queue.health end |
.status ⇒ Hash
Get overall health status
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/pigeon/health_check.rb', line 30 def self.status processor = processor_health queue = queue_health kafka = kafka_health # Determine overall status (worst of all components) components = [processor, queue, kafka] status = determine_overall_status(components) { status: status, components: { processor: processor, queue: queue, kafka: kafka }, timestamp: Time.now.iso8601 } end |