package filters
Type Members
- class AccessLoggingFilter extends TypeAgnostic
Provides a standard "Access Log" -- a list of all requests through this Filter.
Provides a standard "Access Log" -- a list of all requests through this Filter. The Filter uses an implementation of the com.twitter.finagle.filter.LogFormatter, ThriftCommonLogFormatter, which attempts to follow the Common Log Format as closely as possible.
Usage
To use, configure a logger (with your preferred logging implementation) over this class which writes to a specific file (typically named,
access.log
).- Annotations
- @Singleton()
- Note
This Filter should occur as early in the Filter chain as possible such that it is "above" the com.twitter.finatra.thrift.filters.ExceptionMappingFilter.
- See also
- class ExceptionMappingFilter extends TypeAgnostic
A ThriftFilter which handles exceptions by rescuing the exception and passing it to the ExceptionManager to handle it.
A ThriftFilter which handles exceptions by rescuing the exception and passing it to the ExceptionManager to handle it.
- Annotations
- @Singleton()
- Note
This Filter SHOULD be as close to the start of the Filter chain as possible
- class LoggingMDCFilter extends TypeAgnostic
- Annotations
- @Singleton()
- class StatsFilter extends TypeAgnostic
Tracks "per method" statistics scoped under
per_method_stats/<method>
including:Tracks "per method" statistics scoped under
per_method_stats/<method>
including:- success/failure (with exceptions) counters
- latency_ms histogram
Example stats for a successful request to a method named
foo
:per_method_stats/foo/failures 0 per_method_stats/foo/ignored 0 per_method_stats/foo/requests 1 per_method_stats/foo/success 1 per_method_stats/foo/latency_ms 43.000000 [43.0]
Example stats, for a failed request to a method named
foo
:exceptions 1 exceptions/java.lang.Exception 1 per_method_stats/foo/failures 1 per_method_stats/foo/failures/java.lang.Exception 1 per_method_stats/foo/ignored 0 per_method_stats/foo/requests 1 per_method_stats/foo/success 0 per_method_stats/foo/latency_ms 43.000000 [43.0]
Example stats, for a failed request to a method named
foo
with a ResponseClassifier which classifies java.lang.Exception as Ignorable:exceptions 1 exceptions/java.lang.Exception 1 per_method_stats/foo/failures 0 per_method_stats/foo/ignored 1 per_method_stats/foo/ignored/java.lang.Exception 1 per_method_stats/foo/requests 1 per_method_stats/foo/success 0 per_method_stats/foo/latency_ms 43.000000 [43.0]
requests == success + failures + ignored The logical success rate for a method can be calculated as
success / (success + failures)
- Annotations
- @Singleton()
- Note
It is expected that this Filter is inserted ABOVE the ExceptionMappingFilter in a given filter chain, e.g.,
StatsFilter.andThen(ExceptionMappingFilter)
. For the response flow, StatsFilter would happen AFTER ExceptionMappingFilter and calculate mapped result.
- class ThriftMDCFilter extends TypeAgnostic
Note: Any MDC filter must be used in conjunction with the LoggingMDCFilter to ensure that diagnostic context is properly managed.
Note: Any MDC filter must be used in conjunction with the LoggingMDCFilter to ensure that diagnostic context is properly managed.
- Annotations
- @Singleton()
- class TraceIdMDCFilter extends TypeAgnostic
Filter to log tracing data into MDC bag of attributes.
Filter to log tracing data into MDC bag of attributes. Includes traceSampled flag that indicates if the trace is available via tracers Note: Any MDC filter must be used in conjunction with the LoggingMDCFilter to ensure that diagnostic context is properly managed.
- Annotations
- @Singleton()