Package io.sentry.spring7.tracing
Class SentryTracingFilter
java.lang.Object
org.springframework.web.filter.GenericFilterBean
org.springframework.web.filter.OncePerRequestFilter
io.sentry.spring7.tracing.SentryTracingFilter
- All Implemented Interfaces:
jakarta.servlet.Filter,Aware,BeanNameAware,DisposableBean,InitializingBean,EnvironmentAware,EnvironmentCapable,ServletContextAware
Creates
ITransaction around HTTP request executions if performance is enabled. Otherwise
just reads tracing information from incoming request.-
Field Summary
Fields inherited from class org.springframework.web.filter.OncePerRequestFilter
ALREADY_FILTERED_SUFFIXFields inherited from class org.springframework.web.filter.GenericFilterBean
logger -
Constructor Summary
ConstructorsConstructorDescriptionCreates filter that resolves transaction name usingSpringMvcTransactionNameProvider.SentryTracingFilter(@NotNull io.sentry.IScopes scopes) SentryTracingFilter(@NotNull io.sentry.IScopes scopes, @NotNull TransactionNameProvider transactionNameProvider) Creates filter that resolves transaction name using transaction name provider given by parameter.SentryTracingFilter(@NotNull io.sentry.IScopes scopes, @NotNull TransactionNameProvider transactionNameProvider, boolean isAsyncSupportEnabled) Creates filter that resolves transaction name using transaction name provider given by parameter. -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoFilterInternal(@NotNull jakarta.servlet.http.HttpServletRequest httpRequest, @NotNull jakarta.servlet.http.HttpServletResponse httpResponse, @NotNull jakarta.servlet.FilterChain filterChain) protected booleanMethods inherited from class org.springframework.web.filter.OncePerRequestFilter
doFilter, doFilterNestedErrorDispatch, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterErrorDispatchMethods inherited from class org.springframework.web.filter.GenericFilterBean
addRequiredProperty, afterPropertiesSet, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
-
Constructor Details
-
SentryTracingFilter
public SentryTracingFilter()Creates filter that resolves transaction name usingSpringMvcTransactionNameProvider.Only requests that have
HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTErequest attribute set are turned into transactions. This attribute is set inRequestMappingInfoHandlerMappingon request that have not been dropped with anyFilter. -
SentryTracingFilter
public SentryTracingFilter(@NotNull @NotNull io.sentry.IScopes scopes, @NotNull @NotNull TransactionNameProvider transactionNameProvider) Creates filter that resolves transaction name using transaction name provider given by parameter.- Parameters:
scopes- - the scopestransactionNameProvider- - transaction name provider.
-
SentryTracingFilter
public SentryTracingFilter(@NotNull @NotNull io.sentry.IScopes scopes, @NotNull @NotNull TransactionNameProvider transactionNameProvider, boolean isAsyncSupportEnabled) Creates filter that resolves transaction name using transaction name provider given by parameter.- Parameters:
scopes- - the scopestransactionNameProvider- - transaction name provider.isAsyncSupportEnabled- - whether transactions should be kept open until async handling is done
-
SentryTracingFilter
public SentryTracingFilter(@NotNull @NotNull io.sentry.IScopes scopes)
-
-
Method Details
-
shouldNotFilterAsyncDispatch
protected boolean shouldNotFilterAsyncDispatch()- Overrides:
shouldNotFilterAsyncDispatchin classOncePerRequestFilter
-
doFilterInternal
protected void doFilterInternal(@NotNull @NotNull jakarta.servlet.http.HttpServletRequest httpRequest, @NotNull @NotNull jakarta.servlet.http.HttpServletResponse httpResponse, @NotNull @NotNull jakarta.servlet.FilterChain filterChain) throws jakarta.servlet.ServletException, IOException - Specified by:
doFilterInternalin classOncePerRequestFilter- Throws:
jakarta.servlet.ServletExceptionIOException
-