Package io.grpc.xds.orca
Class OrcaMetricReportingServerInterceptor
- java.lang.Object
-
- io.grpc.xds.orca.OrcaMetricReportingServerInterceptor
-
- All Implemented Interfaces:
ServerInterceptor
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/9127") public final class OrcaMetricReportingServerInterceptor extends Object implements ServerInterceptor
AServerInterceptor
that intercepts aServerCall
by running server-side RPC handling under aContext
that records custom per-request metrics provided by server applications and sends to client side along with the response in the format of Open Request Cost Aggregation (ORCA).- Since:
- 1.23.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OrcaMetricReportingServerInterceptor
create(MetricRecorder metricRecorder)
Creates a newOrcaMetricReportingServerInterceptor
instance with the givenMetricRecorder
.static OrcaMetricReportingServerInterceptor
getInstance()
<ReqT,RespT>
ServerCall.Listener<ReqT>interceptCall(ServerCall<ReqT,RespT> call, Metadata headers, ServerCallHandler<ReqT,RespT> next)
-
-
-
Method Detail
-
getInstance
public static OrcaMetricReportingServerInterceptor getInstance()
-
create
public static OrcaMetricReportingServerInterceptor create(@Nullable MetricRecorder metricRecorder)
Creates a newOrcaMetricReportingServerInterceptor
instance with the givenMetricRecorder
. When bothCallMetricRecorder
andMetricRecorder
exist, the metrics are merged such that per-request metrics fromCallMetricRecorder
takes a higher precedence compared to metrics fromMetricRecorder
.
-
interceptCall
public <ReqT,RespT> ServerCall.Listener<ReqT> interceptCall(ServerCall<ReqT,RespT> call, Metadata headers, ServerCallHandler<ReqT,RespT> next)
Description copied from interface:ServerInterceptor
InterceptServerCall
dispatch by thenext
ServerCallHandler
. General semantics ofServerCallHandler.startCall(io.grpc.ServerCall<RequestT, ResponseT>, io.grpc.Metadata)
apply and the returnedServerCall.Listener
must not benull
.If the implementation throws an exception,
call
will be closed with an error. Implementations must not throw an exception if they started processing that may usecall
on another thread.- Specified by:
interceptCall
in interfaceServerInterceptor
- Parameters:
call
- object to receive response messagesheaders
- which can contain extra call metadata fromClientCall.start(io.grpc.ClientCall.Listener<RespT>, io.grpc.Metadata)
, e.g. authentication credentials.next
- next processor in the interceptor chain- Returns:
- listener for processing incoming messages for
call
, nevernull
.
-
-