Class WebMvcMetricsFilter
- java.lang.Object
- org.springframework.web.filter.GenericFilterBean
- org.springframework.web.filter.OncePerRequestFilter
- org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter
- All Implemented Interfaces:
javax.servlet.Filter
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.EnvironmentAware
,org.springframework.core.env.EnvironmentCapable
,org.springframework.web.context.ServletContextAware
public class WebMvcMetricsFilter extends org.springframework.web.filter.OncePerRequestFilter
Intercepts incoming HTTP requests and records metrics about Spring MVC execution time and results.- Since:
- 2.0.0
Constructor Summary
Constructors Constructor Description WebMvcMetricsFilter(io.micrometer.core.instrument.MeterRegistry registry, WebMvcTagsProvider tagsProvider, String metricName, boolean autoTimeRequests)
Create a newWebMvcMetricsFilter
instance.WebMvcMetricsFilter(org.springframework.context.ApplicationContext context, io.micrometer.core.instrument.MeterRegistry registry, WebMvcTagsProvider tagsProvider, String metricName, boolean autoTimeRequests)
Deprecated.since 2.0.7 in favor ofWebMvcMetricsFilter(MeterRegistry, WebMvcTagsProvider, String, boolean)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doFilterInternal(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain filterChain)
protected boolean
shouldNotFilterAsyncDispatch()
Methods inherited from class org.springframework.web.filter.OncePerRequestFilter
doFilter, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterErrorDispatch
Constructor Detail
WebMvcMetricsFilter
@Deprecated public WebMvcMetricsFilter(org.springframework.context.ApplicationContext context, io.micrometer.core.instrument.MeterRegistry registry, WebMvcTagsProvider tagsProvider, String metricName, boolean autoTimeRequests)
Deprecated.since 2.0.7 in favor ofWebMvcMetricsFilter(MeterRegistry, WebMvcTagsProvider, String, boolean)
Create a newWebMvcMetricsFilter
instance.- Parameters:
context
- the source application contextregistry
- the meter registrytagsProvider
- the tags providermetricName
- the metric nameautoTimeRequests
- if requests should be automatically timed
WebMvcMetricsFilter
public WebMvcMetricsFilter(io.micrometer.core.instrument.MeterRegistry registry, WebMvcTagsProvider tagsProvider, String metricName, boolean autoTimeRequests)
Create a newWebMvcMetricsFilter
instance.- Parameters:
registry
- the meter registrytagsProvider
- the tags providermetricName
- the metric nameautoTimeRequests
- if requests should be automatically timed- Since:
- 2.0.7
Method Detail
shouldNotFilterAsyncDispatch
protected boolean shouldNotFilterAsyncDispatch()
- Overrides:
shouldNotFilterAsyncDispatch
in classorg.springframework.web.filter.OncePerRequestFilter
doFilterInternal
protected void doFilterInternal(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain filterChain) throws javax.servlet.ServletException, IOException
- Specified by:
doFilterInternal
in classorg.springframework.web.filter.OncePerRequestFilter
- Throws:
javax.servlet.ServletException
IOException