Class GrpcLifecycleObserverRequesterFilter
- All Implemented Interfaces:
HttpExecutionStrategyInfluencer
,StreamingHttpClientFilterFactory
,StreamingHttpConnectionFilterFactory
,ExecutionStrategyInfluencer<HttpExecutionStrategy>
The result of the observed behavior will depend on the position of this filter in the execution chain.
This filter is recommended to be appended as the first
client filter
using
GrpcClientBuilder.initializeHttp(GrpcClientBuilder.HttpInitializer)
to account for all work done by other
filters. It can be appended at another position, considering the following:
- After a tracing filter or any other filter that populates
request context
,AsyncContext
,MDC
, or altersHttpRequestMetaData
if that information has to be available forGrpcLifecycleObserver.GrpcExchangeObserver
. - After
RetryingHttpRequesterFilter
if each retry attempt should be observed as an independentexchange
. - As a
connection filter
if no user-definedRetryingHttpRequesterFilter
is appended manually but the default auto-retries should be observed as an independentexchange
. - As the last
connection filter
if only network interactions should be observed without accounting for work of any other filters. - After
TimeoutHttpRequesterFilter
(orGrpcFilters.newGrpcDeadlineClientFilterFactory()
) if the timeout event should be observed ascancellation
instead of anerror
. - Before any filter that populates
response context
or altersHttpResponseMetaData
if that information has to be available forGrpcLifecycleObserver.GrpcExchangeObserver
. - Before any filter that maps/translates
HttpResponseMetaData
into anexception
or throws an exception duringresponse payload body transformation
if that exception has to be observed byGrpcLifecycleObserver.GrpcExchangeObserver
. - Using
SingleAddressHttpClientBuilder.appendClientFilter(Predicate, StreamingHttpClientFilterFactory)
orSingleAddressHttpClientBuilder.appendConnectionFilter(Predicate, StreamingHttpConnectionFilterFactory)
if the observer should be applied conditionally.
-
Constructor Summary
ConstructorDescriptionCreate a new instance. -
Method Summary
Modifier and TypeMethodDescriptionfinal HttpExecutionStrategy
Return anExecutionStrategy
that describes the offloads required by the influencer.Methods inherited from class io.servicetalk.http.netty.HttpLifecycleObserverRequesterFilter
create, create
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.servicetalk.http.api.HttpExecutionStrategyInfluencer
influenceStrategy, requiredOffloads
-
Constructor Details
-
GrpcLifecycleObserverRequesterFilter
Create a new instance.- Parameters:
observer
- Theobserver
implementation that consumes gRPC lifecycle events.
-
-
Method Details
-
requiredOffloads
Description copied from interface:HttpExecutionStrategyInfluencer
Return anExecutionStrategy
that describes the offloads required by the influencer.The provided default implementation requests offloading of all operations. Implementations that require no offloading should be careful to return
HttpExecutionStrategies.offloadNone()
rather thanHttpExecutionStrategies.offloadNever()
. Implementations should avoid returningHttpExecutionStrategies.defaultStrategy()
, instead returning the strategy they require orHttpExecutionStrategies.offloadAll()
if offloading for all paths is required (safe default).- Specified by:
requiredOffloads
in interfaceExecutionStrategyInfluencer<HttpExecutionStrategy>
- Specified by:
requiredOffloads
in interfaceHttpExecutionStrategyInfluencer
- Returns:
- the
ExecutionStrategy
required by the influencer.
-