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
AServerInterceptorthat intercepts aServerCallby running server-side RPC handling under aContextthat 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 OrcaMetricReportingServerInterceptorcreate(MetricRecorder metricRecorder)Creates a newOrcaMetricReportingServerInterceptorinstance with the givenMetricRecorder.static OrcaMetricReportingServerInterceptorgetInstance()<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 newOrcaMetricReportingServerInterceptorinstance with the givenMetricRecorder. When bothCallMetricRecorderandMetricRecorderexist, the metrics are merged such that per-request metrics fromCallMetricRecordertakes 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:ServerInterceptorInterceptServerCalldispatch by thenextServerCallHandler. General semantics ofServerCallHandler.startCall(io.grpc.ServerCall<RequestT, ResponseT>, io.grpc.Metadata)apply and the returnedServerCall.Listenermust not benull.If the implementation throws an exception,
callwill be closed with an error. Implementations must not throw an exception if they started processing that may usecallon another thread.- Specified by:
interceptCallin 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.
-
-