package filter
- Alphabetic
- Public
- Protected
Type Members
- trait AbstractDarkTrafficFilter extends AnyRef
- class ClientExceptionTracingFilter[Req, Rep] extends SimpleFilter[Req, Rep]
Reports error and exception annotations when a span completes.
- class DarkTrafficFilter[Req, Rep] extends SimpleFilter[Req, Rep] with AbstractDarkTrafficFilter
Forwards dark traffic to the given service when the given function returns true for a request.
- class DtabStatsFilter[Req, Rep] extends SimpleFilter[Req, Rep]
Adds three stats:
Adds three stats:
- dtab/size, a default stat that tracks the size of both Dtab.limited and Dtab.local for all requests with a non-empty Dtab
- dtab/local/size, a debug stat which tracks just the size of Dtab.local for all requests with a non-empty Dtab
- dtab/limited/size, a debug stat which tracks just the size of Dtab.limited for all requests with a non-empty Dtab
- class ExceptionSourceFilter[Req, Rep] extends SimpleFilter[Req, Rep]
A com.twitter.finagle.Filter that sources exceptions.
A com.twitter.finagle.Filter that sources exceptions. The
serviceName
andappId
fields of any com.twitter.finagle.SourcedException thrown by the underlying com.twitter.finagle.Service is set to theserviceName
andappId
arguments of this filter. - abstract class ForwardingWarmUpFilter[Req, Rep] extends SimpleFilter[Req, Rep]
A filter that forwards thrift requests to a specified service.
A filter that forwards thrift requests to a specified service. It enables a smooth start of processing the requests by slowly increasing the percentage of requests that are being processed and lowering the amount of requests that are being forwarded.
- trait LogFormatter[-Req, Rep] extends AnyRef
- trait LoggingFilter[Req, Rep] extends SimpleFilter[Req, Rep]
A com.twitter.finagle.Filter that logs all requests according to formatter.
- class MaskCancelFilter[Req, Rep] extends SimpleFilter[Req, Rep]
A com.twitter.finagle.Filter that prevents cancellations from propagating to any subsequent Services.
A com.twitter.finagle.Filter that prevents cancellations from propagating to any subsequent Services. i.e. when
Future.raise
is invoked on the result of this filter'sapply
method, the interrupt will not be propagated to the service. This is useful for lightweight protocols for which finishing a request is preferable to closing and reestablishing a connection. - class MkJvmFilter extends AnyRef
Given a
com.twitter.util.Jvm
, use apply to create aFilter
to trace garbage collection events. - class MonitorFilter[Req, Rep] extends SimpleFilter[Req, Rep]
A com.twitter.finagle.Filter that handles exceptions (incl.
A com.twitter.finagle.Filter that handles exceptions (incl. raw) thrown by the subsequent com.twitter.finagle.Service. Exceptions are handled according to the argument com.twitter.util.Monitor.
- class NackAdmissionFilter[Req, Rep] extends SimpleFilter[Req, Rep]
This filter probabilistically drops requests if the nack rate exceeds the
nackRateThreshold
.This filter probabilistically drops requests if the nack rate exceeds the
nackRateThreshold
. In the case that most or all of the cluster which the client is speaking to is overloaded, this will help the cluster cool off.The implementation of this filter is heavily inspired by Chapter 21, section "Client-Side Throttling" of O'Reilly's "Site Reliability Engineering: How Google Runs Production Systems", by Beyer, Jones, Petoff, and Murphy, 1e.
NOTE: Here is a brief summary of the configurable params.
A configuration with a
nackRateThreshold
of N% and awindow
of duration W roughly translates as, "start dropping some requests to the cluster when the nack rate averages at least N% over a window of duration W."Here are some examples of situations with param values chosen to make the filter useful:
- Owners of Service A examine their service's nack rate over several days and find that it is almost always under 10% and rarely above 1% (e.g., during traffic spikes) or 5% (e.g., during a data center outage). They do not want to preemptively drop requests unless the cluster sees an extreme overload situation so they choose a nack rate threshold of 20%. And in such a situation they want the filter to act relatively quickly, so they choose a window of 30 seconds.
- Owners of Service B observe that excess load typically causes peak nack rates of around 25% for up to 60 seconds. They want to be aggressive about avoiding cluster overload and don’t mind dropping some innocent requests during mild load so they choose a window of 10 seconds and a threshold of 0.15 (= 15%).
- class PayloadSizeFilter[Req, Rep] extends SimpleFilter[Req, Rep]
A filter that exports two histograms to a given StatsReceiver.
A filter that exports two histograms to a given StatsReceiver.
1. "request_payload_bytes" - a distribution of request payload sizes in bytes 2. "response_payload_bytes" - a distribution of response payload sizes in bytes
The sizes are also traced using the binary annotations clnt/request_payload_bytes and clnt/response_payload_bytes on the client side, and srv/request_payload_bytes and srv/response_payload_bytes. on the server.
- class RequestMeterFilter[Req, Rep] extends SimpleFilter[Req, Rep]
A com.twitter.finagle.Filter that rate limits requests to a fixed rate over time by using the com.twitter.concurrent.AsyncMeter implementation.
A com.twitter.finagle.Filter that rate limits requests to a fixed rate over time by using the com.twitter.concurrent.AsyncMeter implementation. It can be used for slowing down access to throttled resources. Requests that cannot be enqueued to await a permit are failed immediately with a com.twitter.finagle.Failure that signals that the work was never done, so it's safe to reenqueue.
NOTE: If you're just trying not to be overwhelmed, you almost certainly want to use com.twitter.finagle.filter.RequestSemaphoreFilter instead, because RequestMeterFilter doesn't work well with "real" resources that are sometimes faster or slower (like a service that you're depending on that sometimes slows when it takes bursty traffic). This is better for resources that are artificially bounded, like a rate-limited API.
- class RequestSemaphoreFilter[Req, Rep] extends SimpleFilter[Req, Rep]
A com.twitter.finagle.Filter that restricts request concurrency according to the given com.twitter.concurrent.AsyncSemaphore.
A com.twitter.finagle.Filter that restricts request concurrency according to the given com.twitter.concurrent.AsyncSemaphore. Requests that are unable to acquire a permit are failed immediately with a com.twitter.finagle.Failure that signals a restartable or idempotent process.
- class ToggleAwareSimpleFilter[Req, Rep] extends SimpleFilter[Req, Rep]
Simple filter which calls the underlying filter if the toggle is enabled or passes the call through
Value Members
- object AbstractDarkTrafficFilter
- object DarkTrafficFilter
- object DtabStatsFilter
- object ExceptionSourceFilter
- object MaskCancelFilter
- object NackAdmissionFilter
- object OffloadFilter
These modules introduce async-boundary into the future chain, effectively shifting continuations off of IO threads (into a given FuturePool).
These modules introduce async-boundary into the future chain, effectively shifting continuations off of IO threads (into a given FuturePool).
This filter can be enabled by default through the flag
com.twitter.finagle.offload.numWorkers
. - object PayloadSizeFilter
- object RequestLogger
- object RequestSemaphoreFilter
- object restrictWorkQueueFiberZone extends GlobalFlag[Boolean]