Class: JetstreamHealthController
- Inherits:
-
ActionController::API
- Object
- ActionController::API
- JetstreamHealthController
- Defined in:
- lib/generators/jetstream_bridge/health_check/templates/health_controller.rb
Overview
Health check controller for JetStream Bridge monitoring
This controller provides a health check endpoint for monitoring the JetStream connection status. Use it for Kubernetes liveness/readiness probes, Docker health checks, or load balancer health checks.
Example usage: GET /health/jetstream
Returns: 200 OK - when healthy 503 Service Unavailable - when unhealthy
Instance Method Summary collapse
-
#show ⇒ Object
GET /health/jetstream.
Instance Method Details
#show ⇒ Object
GET /health/jetstream
Returns comprehensive health status including:
- NATS connection status
- JetStream stream information
- Configuration details
- Gem version
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/generators/jetstream_bridge/health_check/templates/health_controller.rb', line 23 def show health = JetstreamBridge.health_check if health[:healthy] render json: health, status: :ok else render json: health, status: :service_unavailable end rescue StandardError => e # Ensure we always return a valid JSON response render json: { healthy: false, error: "#{e.class}: #{e.}" }, status: :service_unavailable end |