Merge branch '6.1.x'
This commit is contained in:
@@ -54,6 +54,11 @@ class ServerHttpObservationFilterTests {
|
||||
private ServerHttpObservationFilter filter = new ServerHttpObservationFilter(this.observationRegistry);
|
||||
|
||||
|
||||
@Test
|
||||
void filterShouldNotProcessAsyncDispatch() {
|
||||
assertThat(this.filter.shouldNotFilterAsyncDispatch()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void filterShouldFillObservationContext() throws Exception {
|
||||
this.filter.doFilter(this.request, this.response, this.mockFilterChain);
|
||||
@@ -64,7 +69,7 @@ class ServerHttpObservationFilterTests {
|
||||
assertThat(context.getCarrier()).isEqualTo(this.request);
|
||||
assertThat(context.getResponse()).isEqualTo(this.response);
|
||||
assertThat(context.getPathPattern()).isNull();
|
||||
assertThatHttpObservation().hasLowCardinalityKeyValue("outcome", "SUCCESS");
|
||||
assertThatHttpObservation().hasLowCardinalityKeyValue("outcome", "SUCCESS").hasBeenStopped();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -121,6 +126,16 @@ class ServerHttpObservationFilterTests {
|
||||
assertThat(this.response.getHeader("X-Trace-Id")).isEqualTo("badc0ff33");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldCloseObservationAfterAsyncCompletion() throws Exception {
|
||||
this.request.setAsyncSupported(true);
|
||||
this.request.startAsync();
|
||||
this.filter.doFilter(this.request, this.response, this.mockFilterChain);
|
||||
this.request.getAsyncContext().complete();
|
||||
|
||||
assertThatHttpObservation().hasLowCardinalityKeyValue("outcome", "SUCCESS").hasBeenStopped();
|
||||
}
|
||||
|
||||
private TestObservationRegistryAssert.TestObservationRegistryAssertReturningObservationContextAssert assertThatHttpObservation() {
|
||||
return TestObservationRegistryAssert.assertThat(this.observationRegistry)
|
||||
.hasObservationWithNameEqualTo("http.server.requests").that();
|
||||
|
||||
Reference in New Issue
Block a user