Class

com.twitter.inject.thrift.filters

ThriftClientFilterChain

Related Doc: package filters

Permalink

class ThriftClientFilterChain[Req <: ThriftStruct, Rep] extends Logging

A com.twitter.finagle.Filter chain builder which provides helper functions for installing and configuring common filters.

Filters configured via the helper methods, e.g., withRetryPolicy, withTimeout, withRequestTimeout, withMethodLatency, withExceptionFilter, will be composed in a specific order, (from top-down, assuming requests/responses enter and exit through the top):

+------------------------+ | latencyFilter | +------------------------+ | exceptionFilter | +------------------------+ | timeoutFilter | +------------------------+ | retryFilter | +------------------------+ | requestTimeoutFilter | +------------------------+ | concurrencyLimitFilter | +------------------------+ | filterChain | +------------------------+

where, the filterChain is the chain of filters added in the order of calls to filtered.

Req

Request type for this filter chain

Rep

Response type for this filter chain

Annotations
@deprecated
Deprecated

(Since version 2018-01-12) Use ThriftMethodBuilderClientModule and ThriftMethodBuilder

See also

com.twitter.finagle.thrift.service.ThriftServicePerEndpoint

com.twitter.inject.thrift.filters.ThriftClientFilterBuilder

Linear Supertypes
Logging, util.logging.Logging, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ThriftClientFilterChain
  2. Logging
  3. Logging
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ThriftClientFilterChain(injector: Injector, statsReceiver: StatsReceiver, clientLabel: String, budget: Budget, method: ThriftMethod, timeoutMultiplier: Int, retryMultiplier: Int, useHighResTimerForRetries: Boolean, andThenService: AndThenService)

    Permalink

    injector

    the com.twitter.inject.Injector

    statsReceiver

    a com.twitter.finagle.stats.StatsReceiver

    clientLabel

    the thrift client label

    budget

    the configured com.twitter.finagle.service.RetryBudget

    method

    the com.twitter.scrooge.ThriftMethod for which this filter chain is configured

    timeoutMultiplier

    a multiplier to apply to timeouts used in any configures com.twitter.finagle.service.TimeoutFilter

    retryMultiplier

    a multiplier to apply to the number of retries used in any configured com.twitter.finagle.service.RetryFilter

    useHighResTimerForRetries

    if a high resolution com.twitter.util.Timer should be used such that retries are run tighter to their schedule

    andThenService

    the com.twitter.finagle.Service to invoke after the filter chain

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def andThen(service: Service[Req, Rep]): Service[Req, Rep]

    Permalink

    After this filter chain is executed this is the com.twitter.finagle.Service to invoke.

    After this filter chain is executed this is the com.twitter.finagle.Service to invoke. The layer of indirection is to allow for servers that wish to intercept the invocation of the bottom service.

    service

    the com.twitter.finagle.Service to invoke at the end of this filter chain

    returns

    a com.twitter.finagle.Service with this filter chain applied

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. var concurrencyLimitFilter: Filter[Req, Rep, Req, Rep]

    Permalink
    Attributes
    protected
  8. def debug(marker: Marker, message: ⇒ Any, cause: Throwable): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  9. def debug(message: ⇒ Any, cause: Throwable): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  10. def debug(marker: Marker, message: ⇒ Any): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  11. def debug(message: ⇒ Any): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  12. def debugFutureResult[T](msg: String)(func: ⇒ Future[T]): Future[T]

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  13. def debugResult[T](message: ⇒ String)(fn: ⇒ T): T

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  14. def defaultRetryMsg(requestAndResponse: (Req, Try[Rep]), duration: Duration): String

    Permalink
    Attributes
    protected
  15. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  17. def error(marker: Marker, message: ⇒ Any, cause: Throwable): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  18. def error(message: ⇒ Any, cause: Throwable): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  19. def error(marker: Marker, message: ⇒ Any): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  20. def error(message: ⇒ Any): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  21. def errorResult[T](message: ⇒ String)(fn: ⇒ T): T

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  22. var exceptionFilterImpl: Filter[Req, Rep, Req, Rep]

    Permalink
    Attributes
    protected
  23. var filterChain: Filter[Req, Rep, Req, Rep]

    Permalink
    Attributes
    protected
  24. def filtered[T <: Filter[Req, Rep, Req, Rep]](implicit arg0: Manifest[T]): ThriftClientFilterChain[Req, Rep]

    Permalink

    Install a com.twitter.finagle.Filter.

    Install a com.twitter.finagle.Filter. This filter will be added to the end of the filter chain. That is, this filter will be invoked AFTER any other installed filter on a request Req and thus BEFORE any other installed filter on a response Rep.

    T

    the type of the filter to instantiate from the injector

    returns

    ThriftClientFilterChain

  25. def filtered(filter: Filter[Req, Rep, Req, Rep]): ThriftClientFilterChain[Req, Rep]

    Permalink

    Install a com.twitter.finagle.Filter.

    Install a com.twitter.finagle.Filter. This filter will be added to the end of the filter chain. That is, this filter will be invoked AFTER any other installed filter on a request Req and thus BEFORE any other installed filter on a response Rep.

    filter

    the com.twitter.finagle.Filter to install.

    returns

    ThriftClientFilterChain

  26. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  27. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  28. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  29. def info(marker: Marker, message: ⇒ Any, cause: Throwable): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  30. def info(message: ⇒ Any, cause: Throwable): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  31. def info(marker: Marker, message: ⇒ Any): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  32. def info(message: ⇒ Any): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  33. def infoResult[T](message: ⇒ String)(fn: ⇒ T): T

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  34. def isDebugEnabled(marker: Marker): Boolean

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  35. def isDebugEnabled: Boolean

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  36. def isErrorEnabled(marker: Marker): Boolean

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  37. def isErrorEnabled: Boolean

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  38. def isInfoEnabled(marker: Marker): Boolean

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  39. def isInfoEnabled: Boolean

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  40. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  41. def isTraceEnabled(marker: Marker): Boolean

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  42. def isTraceEnabled: Boolean

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  43. def isWarnEnabled(marker: Marker): Boolean

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  44. def isWarnEnabled: Boolean

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  45. final def logger: Logger

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  46. final def loggerName: String

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  47. var methodLatencyFilter: Filter[Req, Rep, Req, Rep]

    Permalink
    Attributes
    protected
  48. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  49. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  50. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  51. var requestLatencyFilter: Filter[Req, Rep, Req, Rep]

    Permalink
    Attributes
    protected
  52. var requestTimeoutFilter: Filter[Req, Rep, Req, Rep]

    Permalink
    Attributes
    protected
  53. var retryFilter: Filter[Req, Rep, Req, Rep]

    Permalink
    Attributes
    protected
  54. def scopeStatsReceiver(): StatsReceiver

    Permalink

    Example scope: clnt/thrift/Adder/add1String

    Example scope: clnt/thrift/Adder/add1String

    Attributes
    protected[com.twitter.inject.thrift]
  55. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  56. def time[T](formatStr: String)(func: ⇒ T): T

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  57. var timeoutFilter: Filter[Req, Rep, Req, Rep]

    Permalink
    Attributes
    protected
  58. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  59. def trace(marker: Marker, message: ⇒ Any, cause: Throwable): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  60. def trace(message: ⇒ Any, cause: Throwable): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  61. def trace(marker: Marker, message: ⇒ Any): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  62. def trace(message: ⇒ Any): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  63. def traceResult[T](message: ⇒ String)(fn: ⇒ T): T

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  64. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  65. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  66. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  67. def warn(marker: Marker, message: ⇒ Any, cause: Throwable): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  68. def warn(message: ⇒ Any, cause: Throwable): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  69. def warn(marker: Marker, message: ⇒ Any): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  70. def warn(message: ⇒ Any): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  71. def warnResult[T](message: ⇒ String)(fn: ⇒ T): T

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Logging
  72. def withAgnosticFilter[T <: TypeAgnostic](implicit arg0: Manifest[T]): ThriftClientFilterChain[Req, Rep]

    Permalink

    Install a com.twitter.finagle.Filter.TypeAgnostic that is agnostic to the ThriftMethod Req/Rep types.

    Install a com.twitter.finagle.Filter.TypeAgnostic that is agnostic to the ThriftMethod Req/Rep types. This allows for use of more general filters that do not care about the ThriftMethod input and output types.

    T

    the type of the filter to instantiate from the injector

    returns

    ThriftClientFilterChain

  73. def withAgnosticFilter(filter: TypeAgnostic): ThriftClientFilterChain[Req, Rep]

    Permalink

    Install a com.twitter.finagle.Filter that is agnostic to the ThriftMethod Req/Rep types.

    Install a com.twitter.finagle.Filter that is agnostic to the ThriftMethod Req/Rep types. This allows for use of more general filters that do not care about the ThriftMethod input and output types.

    filter

    the com.twitter.finagle.Filter.TypeAgnostic to install.

    returns

    ThriftClientFilterChain

  74. def withConcurrencyLimit(initialPermits: Int, maxWaiters: Option[Int] = None): ThriftClientFilterChain[Req, Rep]

    Permalink

    Install a com.twitter.finagle.filter.RequestSemaphoreFilter using an com.twitter.concurrent.AsyncSemaphore with an Optional maxWaiters as the limit on the number of waiters for permits.

    Install a com.twitter.finagle.filter.RequestSemaphoreFilter using an com.twitter.concurrent.AsyncSemaphore with an Optional maxWaiters as the limit on the number of waiters for permits.

    initialPermits

    must be positive

    maxWaiters

    must be non-negative if set

    returns

    ThriftClientFilterChain

    See also

    com.twitter.concurrent.AsyncSemaphore

    com.twitter.finagle.filter.RequestSemaphoreFilter

  75. def withConstantRetry(shouldRetry: PartialFunction[(Req, Try[Rep]), Boolean] = PartialFunction.empty, shouldRetryResponse: PartialFunction[Try[Rep], Boolean] = PartialFunction.empty, start: Duration, retries: Int, retryBudget: RetryBudget = budget.retryBudget): ThriftClientFilterChain[Req, Rep]

    Permalink

    Install a com.twitter.finagle.service.RetryFilter configured with a com.twitter.finagle.service.RetryPolicy using constant backoffs.

    Install a com.twitter.finagle.service.RetryFilter configured with a com.twitter.finagle.service.RetryPolicy using constant backoffs.

    shouldRetry

    a PartialFunction over the both the Req and a Try-wrapped returned Rep. Only one of #shouldRetry or #shouldRetryResponse should be configured

    shouldRetryResponse

    a PartialFunction over only the Try-wrapped returned Rep. Only one of #shouldRetry or #shouldRetryResponse should be configured

    start

    how long to delay before retrying

    retries

    number of times to retry

    retryBudget

    a com.twitter.finagle.service.RetryBudget. It is highly recommended to share a single instance of com.twitter.finagle.service.RetryBudget between both retry and re-queue filters to prevent retry storms. As such, use caution here when specifying a new retryBudget

    returns

    ThriftClientFilterChain

    See also

    com.twitter.finagle.service.RetryPolicy

    com.twitter.finagle.service.RetryFilter

    Finagle Client Retries

  76. def withExceptionFilter[T <: Filter[Req, Rep, Req, Rep]](implicit arg0: Manifest[T]): ThriftClientFilterChain[Req, Rep]

    Permalink

    Install a com.twitter.finagle.Filter specific to handling exceptions.

    Install a com.twitter.finagle.Filter specific to handling exceptions. This filter will be correctly positioned in the filter chain near the top of the stack. This filter is generally used to mutate or alter the final response Req based on a returned exception. E.g., to translate a transport-level exception from Finagle to an application-level exception.

    T

    the type of the filter to instantiate from the injector

    returns

    ThriftClientFilterChain

  77. def withExceptionFilter(filter: Filter[Req, Rep, Req, Rep]): ThriftClientFilterChain[Req, Rep]

    Permalink

    Install a com.twitter.finagle.Filter specific to handling exceptions.

    Install a com.twitter.finagle.Filter specific to handling exceptions. This filter will be correctly positioned in the filter chain near the top of the stack. This filter is generally used to mutate or alter the final response Req based on a returned exception. E.g., to translate a transport-level exception from Finagle to an application-level exception.

    filter

    the com.twitter.finagle.Filter to install.

    returns

    ThriftClientFilterChain

  78. def withExponentialRetry(shouldRetry: PartialFunction[(Req, Try[Rep]), Boolean] = PartialFunction.empty, shouldRetryResponse: PartialFunction[Try[Rep], Boolean] = PartialFunction.empty, start: Duration, multiplier: Int, retries: Int): ThriftClientFilterChain[Req, Rep]

    Permalink

    Install a com.twitter.finagle.service.RetryFilter configured with a com.twitter.finagle.service.RetryPolicy using backoffs that grow exponentially using com.twitter.finagle.service.Backoff#decorrelatedJittered.

    Install a com.twitter.finagle.service.RetryFilter configured with a com.twitter.finagle.service.RetryPolicy using backoffs that grow exponentially using com.twitter.finagle.service.Backoff#decorrelatedJittered. The jittered maximum is the start duration * the multiplier value.

    shouldRetry

    a PartialFunction over the both the Req and a Try-wrapped returned Rep. Only one of #shouldRetry or #shouldRetryResponse should be configured

    shouldRetryResponse

    a PartialFunction over only the Try-wrapped returned Rep. Only one of #shouldRetry or #shouldRetryResponse should be configured

    start

    how long to delay before retrying

    multiplier

    used to create a jitter with a random distribution between start and 3 times the previously selected value, capped at start * multiplier. See: com.twitter.finagle.service.Backoff#decorrelatedJittered

    retries

    number of times to retry

    returns

    ThriftClientFilterChain

    See also

    com.twitter.finagle.service.RetryPolicy

    com.twitter.finagle.service.RetryFilter

  79. def withMethodLatency: ThriftClientFilterChain[Req, Rep]

    Permalink

    A parameter-less implementation with defaults

  80. def withMethodLatency(statsReceiver: StatsReceiver = scopedStatsReceiver, timeUnit: TimeUnit = TimeUnit.MILLISECONDS): ThriftClientFilterChain[Req, Rep]

    Permalink

    Install a com.twitter.inject.thrift.internal.filters.LatencyFilter that tracks the "logical" (overall) latency distribution of a method invocation.

    Install a com.twitter.inject.thrift.internal.filters.LatencyFilter that tracks the "logical" (overall) latency distribution of a method invocation. This will INCLUDE any retries as it is installed at the top of the filter stack.

    statsReceiver

    a com.twitter.finagle.stats.StatsReceiver to track StatsFilter measurements. By default this will be the class-level StatsReceiver scoped accordingly.

    timeUnit

    this controls what granularity is used for measuring latency. The default is milliseconds, but other values are valid. The choice of this changes the name of the stat attached to the given com.twitter.finagle.stats.StatsReceiver. For the common units, it will be "latency_ms".

    returns

    ThriftClientFilterChain

    See also

    com.twitter.finagle.service.StatsFilter.DefaultExceptions

    com.twitter.finagle.service.ResponseClassifier

  81. def withRequestLatency: ThriftClientFilterChain[Req, Rep]

    Permalink

    A parameter-less implementation with defaults

  82. def withRequestLatency(statsReceiver: StatsReceiver = scopedStatsReceiver, timeUnit: TimeUnit = TimeUnit.MILLISECONDS): ThriftClientFilterChain[Req, Rep]

    Permalink

    Install a com.twitter.inject.thrift.internal.filters.LatencyFilter that tracks the per-request latency distribution of a method invocation.

    Install a com.twitter.inject.thrift.internal.filters.LatencyFilter that tracks the per-request latency distribution of a method invocation. This will per-retry if the invocation results in retried requests.

    statsReceiver

    a com.twitter.finagle.stats.StatsReceiver to track StatsFilter measurements. By default this will be the class-level StatsReceiver scoped accordingly.

    timeUnit

    this controls what granularity is used for measuring latency. The default is milliseconds, but other values are valid. The choice of this changes the name of the stat attached to the given com.twitter.finagle.stats.StatsReceiver. For the common units, it will be "request_latency_ms".

    returns

    ThriftClientFilterChain

    See also

    com.twitter.finagle.service.StatsFilter.DefaultExceptions

    com.twitter.finagle.service.ResponseClassifier

  83. def withRequestTimeout(duration: Tunable[Duration]): ThriftClientFilterChain[Req, Rep]

    Permalink

    Install a com.twitter.finagle.service.TimeoutFilter configuration with the given tunable timeout.

    Install a com.twitter.finagle.service.TimeoutFilter configuration with the given tunable timeout. This filter will always be "below" any configured retry filter and thus does NOT include retries.

    duration

    the Tunable[Duration] (org.joda.time.Duration) timeout to apply to requests through the filter.

    returns

    ThriftClientFilterChain

    See also

    com.twitter.finagle.service.TimeoutFilter

  84. def withRequestTimeout(duration: Duration): ThriftClientFilterChain[Req, Rep]

    Permalink

    Install a com.twitter.finagle.service.TimeoutFilter configuration with the given org.joda.time.Duration timeout.

    Install a com.twitter.finagle.service.TimeoutFilter configuration with the given org.joda.time.Duration timeout. This filter will always be "below" any configured retry filter and thus does NOT include retries.

    duration

    the org.joda.time.Duration timeout to apply to requests through the filter.

    returns

    ThriftClientFilterChain

    See also

    com.twitter.finagle.service.TimeoutFilter

  85. def withRetryPolicy(retryPolicy: RetryPolicy[(Req, Try[Rep])], retryMsg: ((Req, Try[Rep]), Duration) ⇒ String = defaultRetryMsg): ThriftClientFilterChain[Req, Rep]

    Permalink

    Install a com.twitter.finagle.service.RetryFilter configured with the given com.twitter.finagle.service.RetryPolicy.

    Install a com.twitter.finagle.service.RetryFilter configured with the given com.twitter.finagle.service.RetryPolicy.

    retryPolicy

    the com.twitter.finagle.service.RetryPolicy to use

    retryMsg

    a String message to display before retrying thr request.

    returns

    ThriftClientFilterChain

    See also

    com.twitter.finagle.service.RetryPolicy

    com.twitter.finagle.service.RetryFilter

  86. def withTimeout(duration: Tunable[Duration]): ThriftClientFilterChain[Req, Rep]

    Permalink

    Install a com.twitter.finagle.service.TimeoutFilter configuration with the given tunable timeout.

    Install a com.twitter.finagle.service.TimeoutFilter configuration with the given tunable timeout. This filter will be "above" any configured retry filter and thus includes retries.

    duration

    the Tunable[Duration] (org.joda.time.Duration) timeout to apply to requests through the filter.

    returns

    ThriftClientFilterChain

    See also

    com.twitter.finagle.service.TimeoutFilter

  87. def withTimeout(duration: Duration): ThriftClientFilterChain[Req, Rep]

    Permalink

    Install a com.twitter.finagle.service.TimeoutFilter configuration with the given org.joda.time.Duration timeout.

    Install a com.twitter.finagle.service.TimeoutFilter configuration with the given org.joda.time.Duration timeout. This filter will be "above" and configured retry filter and thus includes retries.

    duration

    the org.joda.time.Duration timeout to apply to requests through the filter.

    returns

    ThriftClientFilterChain

    See also

    com.twitter.finagle.service.TimeoutFilter

Inherited from Logging

Inherited from util.logging.Logging

Inherited from AnyRef

Inherited from Any

Ungrouped