Class: Nonnative::GRPCProbe
- Inherits:
-
Object
- Object
- Nonnative::GRPCProbe
- Defined in:
- lib/nonnative/grpc_probe.rb
Overview
Probes a managed process gRPC health endpoint.
Instance Method Summary collapse
-
#endpoint ⇒ String
Returns the gRPC health endpoint for lifecycle diagnostics.
-
#initialize(process, readiness) ⇒ GRPCProbe
constructor
A new instance of GRPCProbe.
-
#ready? ⇒ Boolean
Returns whether the configured gRPC health endpoint reports SERVING before timeout.
Constructor Details
#initialize(process, readiness) ⇒ GRPCProbe
Returns a new instance of GRPCProbe.
8 9 10 11 12 13 14 15 16 |
# File 'lib/nonnative/grpc_probe.rb', line 8 def initialize(process, readiness) @health = Nonnative::GRPCHealth.new( host: process.host, port: readiness.port, service: readiness.service, timeout: process.timeout ) @timeout = Nonnative::Timeout.new(process.timeout) end |
Instance Method Details
#endpoint ⇒ String
Returns the gRPC health endpoint for lifecycle diagnostics.
37 38 39 |
# File 'lib/nonnative/grpc_probe.rb', line 37 def endpoint health.endpoint end |
#ready? ⇒ Boolean
Returns whether the configured gRPC health endpoint reports SERVING before timeout.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/nonnative/grpc_probe.rb', line 21 def ready? Nonnative.logger.info "checking if readiness '#{endpoint}' is ready" timeout.perform do raise Nonnative::Error unless health.serving? true rescue Nonnative::Error sleep_interval retry end end |