Class RetryPolicy.RateLimitedRetryBackOff

  • All Implemented Interfaces:
    com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, RetryPolicy.RateLimitedRetryBackOffOrBuilder, Serializable
    Enclosing class:
    RetryPolicy

    public static final class RetryPolicy.RateLimitedRetryBackOff
    extends com.google.protobuf.GeneratedMessageV3
    implements RetryPolicy.RateLimitedRetryBackOffOrBuilder
     A retry back-off strategy that applies when the upstream server rate limits
     the request.
     Given this configuration:
     .. code-block:: yaml
       rate_limited_retry_back_off:
         reset_headers:
         - name: Retry-After
           format: SECONDS
         - name: X-RateLimit-Reset
           format: UNIX_TIMESTAMP
         max_interval: "300s"
     The following algorithm will apply:
      1. If the response contains the header ``Retry-After`` its value must be on
         the form ``120`` (an integer that represents the number of seconds to
         wait before retrying). If so, this value is used as the back-off interval.
      2. Otherwise, if the response contains the header ``X-RateLimit-Reset`` its
         value must be on the form ``1595320702`` (an integer that represents the
         point in time at which to retry, as a Unix timestamp in seconds). If so,
         the current time is subtracted from this value and the result is used as
         the back-off interval.
      3. Otherwise, Envoy will use the default
         :ref:`exponential back-off <envoy_v3_api_field_config.route.v3.RetryPolicy.retry_back_off>`
         strategy.
     No matter which format is used, if the resulting back-off interval exceeds
     ``max_interval`` it is discarded and the next header in ``reset_headers``
     is tried. If a request timeout is configured for the route it will further
     limit how long the request will be allowed to run.
     To prevent many clients retrying at the same point in time jitter is added
     to the back-off interval, so the resulting interval is decided by taking:
     ``random(interval, interval * 1.5)``.
     .. attention::
       Configuring ``rate_limited_retry_back_off`` will not by itself cause a request
       to be retried. You will still need to configure the right retry policy to match
       the responses from the upstream server.
     
    Protobuf type envoy.config.route.v3.RetryPolicy.RateLimitedRetryBackOff
    See Also:
    Serialized Form
    • Field Detail

      • RESET_HEADERS_FIELD_NUMBER

        public static final int RESET_HEADERS_FIELD_NUMBER
        See Also:
        Constant Field Values
      • MAX_INTERVAL_FIELD_NUMBER

        public static final int MAX_INTERVAL_FIELD_NUMBER
        See Also:
        Constant Field Values
    • Method Detail

      • newInstance

        protected Object newInstance​(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
        Overrides:
        newInstance in class com.google.protobuf.GeneratedMessageV3
      • getUnknownFields

        public final com.google.protobuf.UnknownFieldSet getUnknownFields()
        Specified by:
        getUnknownFields in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getUnknownFields in class com.google.protobuf.GeneratedMessageV3
      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3
      • getResetHeadersList

        public List<RetryPolicy.ResetHeader> getResetHeadersList()
         Specifies the reset headers (like ``Retry-After`` or ``X-RateLimit-Reset``)
         to match against the response. Headers are tried in order, and matched case
         insensitive. The first header to be parsed successfully is used. If no headers
         match the default exponential back-off is used instead.
         
        repeated .envoy.config.route.v3.RetryPolicy.ResetHeader reset_headers = 1 [(.validate.rules) = { ... }
        Specified by:
        getResetHeadersList in interface RetryPolicy.RateLimitedRetryBackOffOrBuilder
      • getResetHeadersOrBuilderList

        public List<? extends RetryPolicy.ResetHeaderOrBuilder> getResetHeadersOrBuilderList()
         Specifies the reset headers (like ``Retry-After`` or ``X-RateLimit-Reset``)
         to match against the response. Headers are tried in order, and matched case
         insensitive. The first header to be parsed successfully is used. If no headers
         match the default exponential back-off is used instead.
         
        repeated .envoy.config.route.v3.RetryPolicy.ResetHeader reset_headers = 1 [(.validate.rules) = { ... }
        Specified by:
        getResetHeadersOrBuilderList in interface RetryPolicy.RateLimitedRetryBackOffOrBuilder
      • getResetHeadersCount

        public int getResetHeadersCount()
         Specifies the reset headers (like ``Retry-After`` or ``X-RateLimit-Reset``)
         to match against the response. Headers are tried in order, and matched case
         insensitive. The first header to be parsed successfully is used. If no headers
         match the default exponential back-off is used instead.
         
        repeated .envoy.config.route.v3.RetryPolicy.ResetHeader reset_headers = 1 [(.validate.rules) = { ... }
        Specified by:
        getResetHeadersCount in interface RetryPolicy.RateLimitedRetryBackOffOrBuilder
      • getResetHeaders

        public RetryPolicy.ResetHeader getResetHeaders​(int index)
         Specifies the reset headers (like ``Retry-After`` or ``X-RateLimit-Reset``)
         to match against the response. Headers are tried in order, and matched case
         insensitive. The first header to be parsed successfully is used. If no headers
         match the default exponential back-off is used instead.
         
        repeated .envoy.config.route.v3.RetryPolicy.ResetHeader reset_headers = 1 [(.validate.rules) = { ... }
        Specified by:
        getResetHeaders in interface RetryPolicy.RateLimitedRetryBackOffOrBuilder
      • getResetHeadersOrBuilder

        public RetryPolicy.ResetHeaderOrBuilder getResetHeadersOrBuilder​(int index)
         Specifies the reset headers (like ``Retry-After`` or ``X-RateLimit-Reset``)
         to match against the response. Headers are tried in order, and matched case
         insensitive. The first header to be parsed successfully is used. If no headers
         match the default exponential back-off is used instead.
         
        repeated .envoy.config.route.v3.RetryPolicy.ResetHeader reset_headers = 1 [(.validate.rules) = { ... }
        Specified by:
        getResetHeadersOrBuilder in interface RetryPolicy.RateLimitedRetryBackOffOrBuilder
      • hasMaxInterval

        public boolean hasMaxInterval()
         Specifies the maximum back off interval that Envoy will allow. If a reset
         header contains an interval longer than this then it will be discarded and
         the next header will be tried. Defaults to 300 seconds.
         
        .google.protobuf.Duration max_interval = 2 [(.validate.rules) = { ... }
        Specified by:
        hasMaxInterval in interface RetryPolicy.RateLimitedRetryBackOffOrBuilder
        Returns:
        Whether the maxInterval field is set.
      • getMaxInterval

        public com.google.protobuf.Duration getMaxInterval()
         Specifies the maximum back off interval that Envoy will allow. If a reset
         header contains an interval longer than this then it will be discarded and
         the next header will be tried. Defaults to 300 seconds.
         
        .google.protobuf.Duration max_interval = 2 [(.validate.rules) = { ... }
        Specified by:
        getMaxInterval in interface RetryPolicy.RateLimitedRetryBackOffOrBuilder
        Returns:
        The maxInterval.
      • getMaxIntervalOrBuilder

        public com.google.protobuf.DurationOrBuilder getMaxIntervalOrBuilder()
         Specifies the maximum back off interval that Envoy will allow. If a reset
         header contains an interval longer than this then it will be discarded and
         the next header will be tried. Defaults to 300 seconds.
         
        .google.protobuf.Duration max_interval = 2 [(.validate.rules) = { ... }
        Specified by:
        getMaxIntervalOrBuilder in interface RetryPolicy.RateLimitedRetryBackOffOrBuilder
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3
      • writeTo

        public void writeTo​(com.google.protobuf.CodedOutputStream output)
                     throws IOException
        Specified by:
        writeTo in interface com.google.protobuf.MessageLite
        Overrides:
        writeTo in class com.google.protobuf.GeneratedMessageV3
        Throws:
        IOException
      • getSerializedSize

        public int getSerializedSize()
        Specified by:
        getSerializedSize in interface com.google.protobuf.MessageLite
        Overrides:
        getSerializedSize in class com.google.protobuf.GeneratedMessageV3
      • equals

        public boolean equals​(Object obj)
        Specified by:
        equals in interface com.google.protobuf.Message
        Overrides:
        equals in class com.google.protobuf.AbstractMessage
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface com.google.protobuf.Message
        Overrides:
        hashCode in class com.google.protobuf.AbstractMessage
      • parseFrom

        public static RetryPolicy.RateLimitedRetryBackOff parseFrom​(ByteBuffer data,
                                                                    com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                                             throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static RetryPolicy.RateLimitedRetryBackOff parseFrom​(com.google.protobuf.ByteString data)
                                                             throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static RetryPolicy.RateLimitedRetryBackOff parseFrom​(com.google.protobuf.ByteString data,
                                                                    com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                                             throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static RetryPolicy.RateLimitedRetryBackOff parseFrom​(byte[] data)
                                                             throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static RetryPolicy.RateLimitedRetryBackOff parseFrom​(byte[] data,
                                                                    com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                                             throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • newBuilderForType

        public RetryPolicy.RateLimitedRetryBackOff.Builder newBuilderForType()
        Specified by:
        newBuilderForType in interface com.google.protobuf.Message
        Specified by:
        newBuilderForType in interface com.google.protobuf.MessageLite
      • newBuilderForType

        protected RetryPolicy.RateLimitedRetryBackOff.Builder newBuilderForType​(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
        Specified by:
        newBuilderForType in class com.google.protobuf.GeneratedMessageV3
      • getParserForType

        public com.google.protobuf.Parser<RetryPolicy.RateLimitedRetryBackOff> getParserForType()
        Specified by:
        getParserForType in interface com.google.protobuf.Message
        Specified by:
        getParserForType in interface com.google.protobuf.MessageLite
        Overrides:
        getParserForType in class com.google.protobuf.GeneratedMessageV3
      • getDefaultInstanceForType

        public RetryPolicy.RateLimitedRetryBackOff getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder