Package io.grpc.xds
Class FaultFilter
java.lang.Object
io.grpc.xds.FaultFilter
- All Implemented Interfaces:
Filter
,Filter.ClientInterceptorBuilder
HttpFault filter implementation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final class
ADelayedClientCall
with a fixed delay.private final class
An implementation ofClientCall
that fails when started.Nested classes/interfaces inherited from interface io.grpc.xds.Filter
Filter.ClientInterceptorBuilder, Filter.FilterConfig, Filter.NamedFilterConfig, Filter.ServerInterceptorBuilder
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicLong
(package private) static final io.grpc.Metadata.Key
<String> (package private) static final io.grpc.Metadata.Key
<String> (package private) static final io.grpc.Metadata.Key
<String> (package private) static final io.grpc.Metadata.Key
<String> (package private) static final io.grpc.Metadata.Key
<String> (package private) static final FaultFilter
private final ThreadSafeRandom
(package private) static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionio.grpc.ClientInterceptor
buildClientInterceptor
(Filter.FilterConfig config, Filter.FilterConfig overrideConfig, io.grpc.LoadBalancer.PickSubchannelArgs args, ScheduledExecutorService scheduler) private io.grpc.Status
determineFaultAbortStatus
(FaultConfig.FaultAbort faultAbort, io.grpc.Metadata headers) private Long
determineFaultDelayNanos
(FaultConfig.FaultDelay faultDelay, io.grpc.Metadata headers) private static io.grpc.Status
getAbortStatusWithDescription
(io.grpc.Status abortStatus) private static int
(package private) static ConfigOrError
<FaultConfig.FaultAbort> parseFaultAbort
(FaultAbort faultAbort) private static FaultConfig.FaultDelay
parseFaultDelay
(FaultDelay faultDelay) parseFilterConfig
(com.google.protobuf.Message rawProtoMessage) Parses the top-level filter config from raw proto message.parseFilterConfigOverride
(com.google.protobuf.Message rawProtoMessage) Parses the per-filter override filter config from raw proto message.private static ConfigOrError
<FaultConfig> parseHttpFault
(HTTPFault httpFault) private static FaultConfig.FractionalPercent
parsePercent
(FractionalPercent proto) String[]
typeUrls()
The proto message types supported by this filter.
-
Field Details
-
INSTANCE
-
HEADER_DELAY_KEY
-
HEADER_DELAY_PERCENTAGE_KEY
-
HEADER_ABORT_HTTP_STATUS_KEY
-
HEADER_ABORT_GRPC_STATUS_KEY
-
HEADER_ABORT_PERCENTAGE_KEY
-
TYPE_URL
- See Also:
-
random
-
activeFaultCounter
-
-
Constructor Details
-
FaultFilter
FaultFilter(ThreadSafeRandom random, AtomicLong activeFaultCounter)
-
-
Method Details
-
typeUrls
Description copied from interface:Filter
The proto message types supported by this filter. A filter will be registered by each of its supported message types. -
parseFilterConfig
Description copied from interface:Filter
Parses the top-level filter config from raw proto message. The message may be either aAny
or aStruct
.- Specified by:
parseFilterConfig
in interfaceFilter
-
parseHttpFault
-
parseFaultDelay
-
parseFaultAbort
-
parsePercent
-
parseFilterConfigOverride
public ConfigOrError<FaultConfig> parseFilterConfigOverride(com.google.protobuf.Message rawProtoMessage) Description copied from interface:Filter
Parses the per-filter override filter config from raw proto message. The message may be either aAny
or aStruct
.- Specified by:
parseFilterConfigOverride
in interfaceFilter
-
buildClientInterceptor
@Nullable public io.grpc.ClientInterceptor buildClientInterceptor(Filter.FilterConfig config, @Nullable Filter.FilterConfig overrideConfig, io.grpc.LoadBalancer.PickSubchannelArgs args, ScheduledExecutorService scheduler) - Specified by:
buildClientInterceptor
in interfaceFilter.ClientInterceptorBuilder
-
getAbortStatusWithDescription
private static io.grpc.Status getAbortStatusWithDescription(io.grpc.Status abortStatus) -
determineFaultDelayNanos
@Nullable private Long determineFaultDelayNanos(FaultConfig.FaultDelay faultDelay, io.grpc.Metadata headers) -
determineFaultAbortStatus
@Nullable private io.grpc.Status determineFaultAbortStatus(FaultConfig.FaultAbort faultAbort, io.grpc.Metadata headers) -
getRatePerMillion
-