Class OrcaServiceImpl
java.lang.Object
io.grpc.xds.orca.OrcaServiceImpl
- All Implemented Interfaces:
io.grpc.BindableService
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/9006")
public final class OrcaServiceImpl
extends Object
implements io.grpc.BindableService
Implements a
BindableService that generates Out-Of-Band server metrics.
Register the returned service to the server, then a client can request for periodic load reports.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final classprivate final class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final AtomicIntegerstatic final longEmpty or invalid (non-positive) minInterval config in will be treated to this default value.private final OrcaServiceImpl.RealOrcaServiceImplprivate static final Loggerprivate io.grpc.services.MetricRecorderprivate final longprivate final ScheduledExecutorService -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateOrcaServiceImpl(long minInterval, TimeUnit timeUnit, ScheduledExecutorService timeService, io.grpc.services.MetricRecorder orcaMetrics) -
Method Summary
Modifier and TypeMethodDescriptionio.grpc.ServerServiceDefinitionstatic io.grpc.BindableServicecreateService(ScheduledExecutorService timeService, io.grpc.services.MetricRecorder metricRecorder) static io.grpc.BindableServicecreateService(ScheduledExecutorService timeService, io.grpc.services.MetricRecorder metricsRecorder, long minInterval, TimeUnit timeUnit) Constructs a service to report server metrics.private OrcaLoadReport
-
Field Details
-
logger
-
DEFAULT_MIN_REPORT_INTERVAL_NANOS
public static final long DEFAULT_MIN_REPORT_INTERVAL_NANOSEmpty or invalid (non-positive) minInterval config in will be treated to this default value. -
minReportIntervalNanos
private final long minReportIntervalNanos -
timeService
-
clientCount
-
metricRecorder
private io.grpc.services.MetricRecorder metricRecorder -
delegate
-
-
Constructor Details
-
OrcaServiceImpl
private OrcaServiceImpl(long minInterval, TimeUnit timeUnit, ScheduledExecutorService timeService, io.grpc.services.MetricRecorder orcaMetrics)
-
-
Method Details
-
createService
public static io.grpc.BindableService createService(ScheduledExecutorService timeService, io.grpc.services.MetricRecorder metricsRecorder, long minInterval, TimeUnit timeUnit) Constructs a service to report server metrics. Config the report interval lower bound, the executor to run the timer, and aMetricRecorderthat contains metrics data.- Parameters:
minInterval- configures the minimum metrics reporting interval for the service. Bad configuration (non-positive) will be overridden to service default (30s). Minimum metrics reporting interval means, if the setting in the client's request is invalid (non-positive) or below this value, they will be treated as this value.
-
createService
public static io.grpc.BindableService createService(ScheduledExecutorService timeService, io.grpc.services.MetricRecorder metricRecorder) -
bindService
public io.grpc.ServerServiceDefinition bindService()- Specified by:
bindServicein interfaceio.grpc.BindableService
-
generateMetricsReport
-