|
|
|
|
@ -44,8 +44,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
@@ -44,8 +44,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
import org.springframework.web.context.WebApplicationContext; |
|
|
|
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc; |
|
|
|
|
import org.springframework.web.util.NestedServletException; |
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
|
import static org.assertj.core.api.Assertions.assertThatExceptionOfType; |
|
|
|
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; |
|
|
|
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
|
|
|
|
|
|
|
|
|
@ -84,7 +86,8 @@ class WebMvcMetricsIntegrationTests {
@@ -84,7 +86,8 @@ class WebMvcMetricsIntegrationTests {
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void rethrownExceptionIsRecordedInMetricTag() throws Exception { |
|
|
|
|
this.mvc.perform(get("/api/rethrownError")).andExpect(status().is5xxServerError()); |
|
|
|
|
assertThatExceptionOfType(NestedServletException.class) |
|
|
|
|
.isThrownBy(() -> this.mvc.perform(get("/api/rethrownError")).andReturn()); |
|
|
|
|
assertThat(this.registry.get("http.server.requests").tags("exception", "Exception2", "status", "500").timer() |
|
|
|
|
.count()).isEqualTo(1L); |
|
|
|
|
} |
|
|
|
|
|