public class WeightedStatsRequestInterceptor extends BaseWeightedStats implements RequestInterceptor
RequestInterceptor
that hooks into request lifecycle and calls methods of the parent
class to manage tracking state and expose WeightedStats
.
This interceptor the default mechanism for gathering stats when WeightedLoadbalanceStrategy
is used with LoadbalanceRSocketClient
.
LoadbalanceRSocketClient
,
WeightedLoadbalanceStrategy
Disposable.Composite, Disposable.Swap
Constructor and Description |
---|
WeightedStatsRequestInterceptor() |
Modifier and Type | Method and Description |
---|---|
void |
dispose() |
void |
onCancel(int streamId,
FrameType requestType)
Method which is being invoked once a successfully accepted request is cancelled.
|
void |
onReject(Throwable rejectionReason,
FrameType requestType,
ByteBuf metadata)
Method which is being invoked on the request rejection.
|
void |
onStart(int streamId,
FrameType requestType,
ByteBuf metadata)
Method which is being invoked on successful acceptance and start of a request.
|
void |
onTerminate(int streamId,
FrameType requestType,
Throwable t)
Method which is being invoked once a successfully accepted request is terminated.
|
higherQuantileLatency, lowerQuantileLatency, pending, predictedLatency, toString, weightedAvailability
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isDisposed
wrap
public final void onStart(int streamId, FrameType requestType, @Nullable ByteBuf metadata)
RequestInterceptor
onStart
in interface RequestInterceptor
streamId
- used for the requestrequestType
- of the request. Must be one of the following types FrameType.REQUEST_FNF
, FrameType.REQUEST_RESPONSE
, FrameType.REQUEST_STREAM
or FrameType.REQUEST_CHANNEL
metadata
- taken from the initial framepublic final void onTerminate(int streamId, FrameType requestType, @Nullable Throwable t)
RequestInterceptor
RequestInterceptor.onStart(int, FrameType, ByteBuf)
method. This method is
exclusive with RequestInterceptor.onCancel(int, FrameType)
.onTerminate
in interface RequestInterceptor
streamId
- used by this requestrequestType
- of the request. Must be one of the following types FrameType.REQUEST_FNF
, FrameType.REQUEST_RESPONSE
, FrameType.REQUEST_STREAM
or FrameType.REQUEST_CHANNEL
t
- with which this finished has terminated. Must be one of the following signalspublic final void onCancel(int streamId, FrameType requestType)
RequestInterceptor
RequestInterceptor.onStart(int, FrameType, ByteBuf)
method. This method is
exclusive with RequestInterceptor.onTerminate(int, FrameType, Throwable)
.onCancel
in interface RequestInterceptor
streamId
- used by this requestrequestType
- of the request. Must be one of the following types FrameType.REQUEST_FNF
, FrameType.REQUEST_RESPONSE
, FrameType.REQUEST_STREAM
or FrameType.REQUEST_CHANNEL
public final void onReject(Throwable rejectionReason, FrameType requestType, ByteBuf metadata)
RequestInterceptor
RequestInterceptor.onStart(int, FrameType,
ByteBuf)
method. The reason for rejection can be one of the following:
onReject
in interface RequestInterceptor
rejectionReason
- exception which causes rejection of a particular requestrequestType
- of the request. Must be one of the following types FrameType.REQUEST_FNF
, FrameType.REQUEST_RESPONSE
, FrameType.REQUEST_STREAM
or FrameType.REQUEST_CHANNEL
metadata
- taken from the initial framepublic void dispose()
dispose
in interface Disposable