Class: Async::Service::Supervisor::Envoy::ORCAService
- Inherits:
-
GRPC::Service
- Object
- GRPC::Service
- Async::Service::Supervisor::Envoy::ORCAService
- Defined in:
- lib/async/service/supervisor/envoy/orca_service.rb
Overview
Streams per-worker out-of-band ORCA load reports to Envoy.
Constant Summary collapse
- SERVICE_NAME =
"xds.service.orca.v3.OpenRcaService"- EMPTY_REPORT =
Xds::Data::Orca::V3::OrcaLoadReport.new( named_metrics: {"orca.heartbeat" => 0.0} )
Instance Method Summary collapse
-
#initialize(monitor, minimum_interval: 1) ⇒ ORCAService
constructor
Initialize the ORCA service.
-
#stream_core_metrics(input, output, call) ⇒ Object
Stream current load reports for the worker named by the request authority.
Constructor Details
#initialize(monitor, minimum_interval: 1) ⇒ ORCAService
Initialize the ORCA service.
24 25 26 27 28 29 |
# File 'lib/async/service/supervisor/envoy/orca_service.rb', line 24 def initialize(monitor, minimum_interval: 1) super(Xds::Service::Orca::V3::OpenRcaService, SERVICE_NAME) @monitor = monitor @minimum_interval = minimum_interval end |
Instance Method Details
#stream_core_metrics(input, output, call) ⇒ Object
Stream current load reports for the worker named by the request authority.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/async/service/supervisor/envoy/orca_service.rb', line 36 def stream_core_metrics(input, output, call) request = input.read return unless request = call.request. interval = [duration(request.report_interval), @minimum_interval].max while @monitor.worker?() output.write(@monitor.load_report() || EMPTY_REPORT) sleep(interval) end rescue Protocol::HTTP::Body::Writable::Closed # The client closed the reporting stream. end |