You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrade to Spring Boot 2.7.0 MVC metrics stop working.
What I've found is that webMvcMetricsFilter is not created.
There is new @ConditionalOnMissingBean annotation added In WebMvcMetricsAutoConfiguration:
@Bean
@ConditionalOnMissingBean
public FilterRegistrationBean<WebMvcMetricsFilter> webMvcMetricsFilter(MeterRegistry registry,
WebMvcTagsProvider tagsProvider) {
Unfortunately, when using property server.forward-headers-strategy=framework other bean forwardedHeaderFilter is created and webMvcMetricsFilter is not called.
However ForwardedHeaderFilterConfiguration uses more precise @ConditionalOnMissingFilterBean(ForwardedHeaderFilter.class) annotation:
So, as temporary solution, I've created webMvcMetricsFilter manually in my project.
But looks like webMvcMetricsFilter should be annotated with something like this: @ConditionalOnMissingFilterBean(WebMvcMetricsFilter.class) instead of simple @ConditionalOnMissingBean
The text was updated successfully, but these errors were encountered:
Dominys
changed the title
MVC metrics not working if forward-headers-strategy framework is used
MVC metrics not working if forward-headers-strategy=framework property is used
Jun 23, 2022
After upgrade to Spring Boot 2.7.0 MVC metrics stop working.
What I've found is that webMvcMetricsFilter is not created.
There is new
@ConditionalOnMissingBean
annotation added InWebMvcMetricsAutoConfiguration
:Unfortunately, when using property
server.forward-headers-strategy=framework
other beanforwardedHeaderFilter
is created andwebMvcMetricsFilter
is not called.However
ForwardedHeaderFilterConfiguration
uses more precise@ConditionalOnMissingFilterBean(ForwardedHeaderFilter.class)
annotation:So, as temporary solution, I've created
webMvcMetricsFilter
manually in my project.But looks like webMvcMetricsFilter should be annotated with something like this:
@ConditionalOnMissingFilterBean(WebMvcMetricsFilter.class)
instead of simple@ConditionalOnMissingBean
The text was updated successfully, but these errors were encountered: