-
Notifications
You must be signed in to change notification settings - Fork 40.4k
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
WebMvcMetricsFilter stopped working since 2.7.0 #31150
Comments
Thanks for the report, @varpa89, and apologies for the inconvenience. You can work around the problem with the following bean declaration in your application: public FilterRegistrationBean<WebMvcMetricsFilter> webMvcMetricsFilter(MetricsProperties properties,
MeterRegistry registry, WebMvcTagsProvider tagsProvider) {
ServerRequest request = properties.getWeb().getServer().getRequest();
WebMvcMetricsFilter filter = new WebMvcMetricsFilter(registry, tagsProvider, request.getMetricName(),
request.getAutotime());
FilterRegistrationBean<WebMvcMetricsFilter> registration = new FilterRegistrationBean<>(filter);
registration.setOrder(Ordered.HIGHEST_PRECEDENCE + 1);
registration.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.ASYNC);
return registration;
} |
Do I understand correctly that previous behaviour will be restored with v2.7.1 ? The update to v2.7.0 broke our |
Correct. You can confirm that's the case by trying a 2.7.1-SNAPSHOT available from https://repo.spring.io/snapshot or using the workaround above. If you still have a problem with |
Co-authored-by: Marco Geweke <marco.geweke@otto.de>
Hey, a workaround with a bit more code reuse:
|
Thanks for trying to help, @ChristianAnke, but we do not recommend injecting (auto-)configuration classes and calling methods on them. While the workaround above is slightly more verbose, we believe it's more robust and is what we recommend users do until 2.7.1 has been released with a fix. |
Thanks @varpa89 for your workaround, saved my day :-) |
Since Spring Boot 2.7.0 there is no
WebMvcMetricsFilter
in the context fromWebMvcMetricsAutoConfiguration
so we lost timing metrics.Probably we should specify the class in
@ConditionalOnMissingBean
annotationThe text was updated successfully, but these errors were encountered: