Secondary constructor which accepts a StatsReceiver.
Secondary constructor which accepts a StatsReceiver. The HttpResponseClassifier is defaulted to HttpResponseClassifier.ServerErrorsAsFailures.
the com.twitter.finagle.stats.StatsReceiver to which to record stats.
the com.twitter.finagle.stats.StatsReceiver to which to record stats.
an HttpResponseClassifier used to determine when a response is successful or not.
The application of the ResponseClassifier differs from the Finagle default.
The application of the ResponseClassifier differs from the Finagle default. This class attempts to preserve information in the emitted metrics. That is, if an exception is returned, even if it is classified as a "success", we incr the exception counter(s) (in addition to the "success" or "failures" counters). Conversely, if a response (non-exception) is returned which is classified as a "failure", we incr the "failures" counter but we do not incr any exception counter. Finally, for responses or exceptions classified as "ignorable", we incr the "ignored" counter and the exception counter(s).
*-----------------*---------------------------* | Returned Response | *----------------*-----------------*---------------------------* | Classification | RESPONSE | EXCEPTION | *----------------*-----------------*---------------------------* | SUCCESSFUL | success.incr() | success.incr(), exc.incr()| *----------------*-----------------*---------------------------* | FAILED | failed.incr() | failed.incr(), exc.incr() | *----------------|-----------------|---------------------------| | IGNORABLE | (no-op) | ignored.incr(), exc.incr()| *----------------*-----------------*---------------------------*
com.twitter.finagle.service.ResponseClassifier
com.twitter.finagle.service.StatsFilter
A drop-in replacement for com.twitter.finagle.http.filter.StatsFilter with per-route stats scoped under
route/<name>/<method>
.Example stats for a successful GET request to a route named
/foo
:Example stats for a failed GET request to a route named
/foo
:Example stats for a failed GET request to a route named
/foo
which classifies the failure as Ignorable::requests == success + failures + ignored The logical success rate for a method can be calculated as
success / (success + failures)
the type of the StatsFilter which is upper bounded by the com.twitter.finagle.http.Request type.
It is expected that this Filter occurs "BEFORE" the ExceptionMappingFilter in a given filter chain, e.g.,
StatsFilter.andThen(ExceptionMappingFilter)
. It is expected that there SHOULD be a returned response because the ExceptionMappingFilter should return give a non-exception response.Finagle HTTP StatsFilter