Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MVC metrics not working if forward-headers-strategy=framework property is used #31513

Closed
Dominys opened this issue Jun 23, 2022 · 1 comment
Closed
Labels
status: duplicate A duplicate of another issue

Comments

@Dominys
Copy link

Dominys commented 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 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:

@Configuration(proxyBeanMethods = false)
	@ConditionalOnProperty(value = "server.forward-headers-strategy", havingValue = "framework")
	@ConditionalOnMissingFilterBean(ForwardedHeaderFilter.class)
	static class ForwardedHeaderFilterConfiguration {

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

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 23, 2022
@Dominys 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
@wilkinsona
Copy link
Member

Duplicates #31150.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Jun 23, 2022
@wilkinsona wilkinsona added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants