javax.servlet.Filter
SpringServletFilter
public class BeelineServletFilter extends Object implements javax.servlet.Filter
Filter
implementation for tracing requests and submitting the spans to Honeycomb.
Creates a root span for incoming requests with DispatcherType
REQUEST
.
Will also create a child span if the request is redispatched, i.e. via an FORWARD
, INCLUDE
or ERROR
DispatcherType
.
If the request is dispatched using the ASYNC
DispatcherType
, then the span will have fields
added to it that indicate this.
Optionally, the filter can be parameterized with functions that generate custom span names for request and redispatch
spans. By default the DEFAULT_REQUEST_SPAN_NAMING_FUNCTION
and DEFAULT_REDISPATCH_SPAN_NAMING_FUNCTION
are used.
Optionally, the filter can be parameterized with a whitelist and/or a blacklist of request path patterns. These are used to determine whether a request is included or excluded from being a candidate for tracing. The patterns must be Ant-style path patterns. If no include patterns are specified then, by default, all requests are included. If no exclude patterns are specified then, by default, no requests are excluded.
Optionally, the default path matching algorithm can be overridden by supplying your own instance of a PathMatcher
in the constructor.
Use BeelineServletFilter.Builder
to construct an instance of the filter.
Compatible with Servlet 3.1+.
AntPathMatcher
Modifier and Type | Class | Description |
---|---|---|
static class |
BeelineServletFilter.Builder |
Helper class to construct a
BeelineServletFilter |
protected static class |
BeelineServletFilter.HttpServerRequestAdapter |
|
protected static class |
BeelineServletFilter.HttpServerResponseAdapter |
|
protected static class |
BeelineServletFilter.TraceListener |
Modifier and Type | Field | Description |
---|---|---|
static Function<javax.servlet.http.HttpServletRequest,String> |
DEFAULT_REDISPATCH_SPAN_NAMING_FUNCTION |
|
static Function<HttpServerRequestAdapter,String> |
DEFAULT_REQUEST_SPAN_NAMING_FUNCTION |
Modifier | Constructor | Description |
---|---|---|
protected |
BeelineServletFilter(String serviceName,
Beeline beeline,
List<String> includePaths,
List<String> excludePaths,
Function<javax.servlet.http.HttpServletRequest,String> requestToRedispatchSpanName,
Function<HttpServerRequestAdapter,String> requestToSpanName,
PathMatcher pathMatcher) |
Modifier and Type | Method | Description |
---|---|---|
static BeelineServletFilter.Builder |
builder() |
|
void |
destroy() |
|
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain) |
|
protected String |
getAsyncDispatchSpanFieldName() |
|
protected String |
getDispatcherTypeSpanFieldName() |
|
void |
init(javax.servlet.FilterConfig filterConfig) |
public static final Function<HttpServerRequestAdapter,String> DEFAULT_REQUEST_SPAN_NAMING_FUNCTION
protected BeelineServletFilter(String serviceName, Beeline beeline, List<String> includePaths, List<String> excludePaths, Function<javax.servlet.http.HttpServletRequest,String> requestToRedispatchSpanName, Function<HttpServerRequestAdapter,String> requestToSpanName, PathMatcher pathMatcher)
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
IOException
javax.servlet.ServletException
protected String getAsyncDispatchSpanFieldName()
protected String getDispatcherTypeSpanFieldName()
public void init(javax.servlet.FilterConfig filterConfig)
init
in interface javax.servlet.Filter
public void destroy()
destroy
in interface javax.servlet.Filter
public static BeelineServletFilter.Builder builder()
Copyright © 2019–2020 Honeycomb. All rights reserved.