public final class MetricsInterceptor<ReqT,ResT> extends SimpleInterceptor<ReqT,ResT>
Modifier and Type | Method and Description |
---|---|
static InterceptorFactory |
newFactory(Endpoint endpoint,
com.codahale.metrics.MetricRegistry metrics)
Creates a new
InterceptorFactory . |
io.grpc.Status |
onComplete(io.grpc.Status status,
ReqT req,
ResT res,
io.grpc.Metadata trailers)
Invoked when request is finished.
|
void |
onHalfClose(ReqT req,
io.grpc.Metadata headers)
gRPC invokes the actual method implementation in the onHalfClose method.
|
void |
onStart(ReqT req,
io.grpc.Metadata headers)
Invoked when request is starting.
|
public static InterceptorFactory newFactory(Endpoint endpoint, com.codahale.metrics.MetricRegistry metrics)
InterceptorFactory
.endpoint
- endpointmetrics
- metricspublic void onStart(ReqT req, io.grpc.Metadata headers)
SimpleInterceptor
onStart
in class SimpleInterceptor<ReqT,ResT>
req
- proto requestheaders
- request metadatapublic void onHalfClose(ReqT req, io.grpc.Metadata headers)
SimpleInterceptor
The method can potentially be invoked on a thread different from the
one that called SimpleInterceptor.onStart(ReqT, io.grpc.Metadata)
. So all the features that rely on
thread local for processing need to perform the initialization in this
method and NOT in SimpleInterceptor.onStart(ReqT, io.grpc.Metadata)
.
onHalfClose
in class SimpleInterceptor<ReqT,ResT>
req
- proto requestheaders
- request metadatapublic io.grpc.Status onComplete(io.grpc.Status status, ReqT req, ResT res, io.grpc.Metadata trailers)
SimpleInterceptor
onComplete
in class SimpleInterceptor<ReqT,ResT>
status
- request status, if not successful response is not going to be presentreq
- proto requestres
- proto responsetrailers
- response metadata