Class: A2A::Monitoring::HealthMiddleware
- Inherits:
-
Object
- Object
- A2A::Monitoring::HealthMiddleware
- Defined in:
- lib/a2a/monitoring/health_endpoints.rb
Overview
Rack middleware for health endpoints
Instance Method Summary collapse
- #call(env) ⇒ Object
- #health_endpoint?(path) ⇒ Boolean private
-
#initialize(app, health_endpoints = nil) ⇒ HealthMiddleware
constructor
A new instance of HealthMiddleware.
Constructor Details
#initialize(app, health_endpoints = nil) ⇒ HealthMiddleware
Returns a new instance of HealthMiddleware.
183 184 185 186 |
# File 'lib/a2a/monitoring/health_endpoints.rb', line 183 def initialize(app, health_endpoints = nil) @app = app @health_endpoints = health_endpoints || HealthEndpoints.new end |
Instance Method Details
#call(env) ⇒ Object
188 189 190 191 192 193 194 195 |
# File 'lib/a2a/monitoring/health_endpoints.rb', line 188 def call(env) # Check if this is a health endpoint request if health_endpoint?(env["PATH_INFO"]) @health_endpoints.call(env) else @app.call(env) end end |
#health_endpoint?(path) ⇒ Boolean (private)
199 200 201 |
# File 'lib/a2a/monitoring/health_endpoints.rb', line 199 def health_endpoint?(path) path&.start_with?("/health") || path == "/metrics" end |