Revert "Apply filter order to ServerHttpObservationFilter"

This reverts commit efcc65bc5b.
pull/35874/head
Moritz Halbritter 1 year ago
parent 60553415d0
commit 849f65a0de

@ -40,6 +40,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.http.server.observation.DefaultServerRequestObservationConvention;
import org.springframework.http.server.observation.ServerRequestObservationConvention;
@ -53,7 +54,6 @@ import org.springframework.web.servlet.DispatcherServlet;
* @author Brian Clozel
* @author Jon Schneider
* @author Dmytro Nosan
* @author Moritz Halbritter
* @since 3.0.0
*/
@AutoConfiguration(after = { MetricsAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class,
@ -74,7 +74,7 @@ public class WebMvcObservationAutoConfiguration {
.getIfAvailable(() -> new DefaultServerRequestObservationConvention(name));
ServerHttpObservationFilter filter = new ServerHttpObservationFilter(registry, convention);
FilterRegistrationBean<ServerHttpObservationFilter> registration = new FilterRegistrationBean<>(filter);
registration.setOrder(observationProperties.getHttp().getServer().getFilter().getOrder());
registration.setOrder(Ordered.HIGHEST_PRECEDENCE + 1);
registration.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.ASYNC);
return registration;
}

@ -57,7 +57,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
* @author Tadaya Tsuyukubo
* @author Madhura Bhave
* @author Chanhyeong LEE
* @author Moritz Halbritter
*/
@ExtendWith(OutputCaptureExtension.class)
class WebMvcObservationAutoConfigurationTests {
@ -101,15 +100,6 @@ class WebMvcObservationAutoConfigurationTests {
});
}
@Test
void filterRegistrationOrderCanBeOverridden() {
this.contextRunner.withPropertyValues("management.observations.http.server.filter.order=1000")
.run((context) -> {
FilterRegistrationBean<?> registration = context.getBean(FilterRegistrationBean.class);
assertThat(registration.getOrder()).isEqualTo(1000);
});
}
@Test
void filterRegistrationBacksOffWithAnotherServerHttpObservationFilterRegistration() {
this.contextRunner.withUserConfiguration(TestServerHttpObservationFilterRegistrationConfiguration.class)

Loading…
Cancel
Save