Package io.grpc.xds.orca
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 java.lang.Object implements io.grpc.BindableService
Implements aBindableService
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 Classes Modifier and Type Class Description private class
OrcaServiceImpl.OrcaClient
private class
OrcaServiceImpl.RealOrcaServiceImpl
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.concurrent.atomic.AtomicInteger
clientCount
static long
DEFAULT_MIN_REPORT_INTERVAL_NANOS
Empty or invalid (non-positive) minInterval config in will be treated to this default value.private OrcaServiceImpl.RealOrcaServiceImpl
delegate
private static java.util.logging.Logger
logger
private io.grpc.services.MetricRecorder
metricRecorder
private long
minReportIntervalNanos
private java.util.concurrent.ScheduledExecutorService
timeService
-
Constructor Summary
Constructors Modifier Constructor Description private
OrcaServiceImpl(long minInterval, java.util.concurrent.TimeUnit timeUnit, java.util.concurrent.ScheduledExecutorService timeService, io.grpc.services.MetricRecorder orcaMetrics)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description io.grpc.ServerServiceDefinition
bindService()
static io.grpc.BindableService
createService(java.util.concurrent.ScheduledExecutorService timeService, io.grpc.services.MetricRecorder metricRecorder)
static io.grpc.BindableService
createService(java.util.concurrent.ScheduledExecutorService timeService, io.grpc.services.MetricRecorder metricsRecorder, long minInterval, java.util.concurrent.TimeUnit timeUnit)
Constructs a service to report server metrics.private OrcaLoadReport
generateMetricsReport()
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
DEFAULT_MIN_REPORT_INTERVAL_NANOS
public static final long DEFAULT_MIN_REPORT_INTERVAL_NANOS
Empty or invalid (non-positive) minInterval config in will be treated to this default value.
-
minReportIntervalNanos
private final long minReportIntervalNanos
-
timeService
private final java.util.concurrent.ScheduledExecutorService timeService
-
clientCount
final java.util.concurrent.atomic.AtomicInteger clientCount
-
metricRecorder
private io.grpc.services.MetricRecorder metricRecorder
-
delegate
private final OrcaServiceImpl.RealOrcaServiceImpl delegate
-
-
Method Detail
-
createService
public static io.grpc.BindableService createService(java.util.concurrent.ScheduledExecutorService timeService, io.grpc.services.MetricRecorder metricsRecorder, long minInterval, java.util.concurrent.TimeUnit timeUnit)
Constructs a service to report server metrics. Config the report interval lower bound, the executor to run the timer, and aMetricRecorder
that 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(java.util.concurrent.ScheduledExecutorService timeService, io.grpc.services.MetricRecorder metricRecorder)
-
bindService
public io.grpc.ServerServiceDefinition bindService()
- Specified by:
bindService
in interfaceio.grpc.BindableService
-
generateMetricsReport
private OrcaLoadReport generateMetricsReport()
-
-