Rework HTTP exchange tracing and add support for WebFlux

Closes gh-9980
This commit is contained in:
Andy Wilkinson
2018-01-22 11:46:35 +00:00
parent 11064b5d78
commit 3565961d68
49 changed files with 2471 additions and 1217 deletions

View File

@@ -166,41 +166,6 @@ public class SampleActuatorApplicationTests {
assertThat(body).contains("This application has no explicit mapping for /error");
}
@Test
@SuppressWarnings("unchecked")
public void testTrace() {
this.restTemplate.getForEntity("/health", String.class);
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate
.withBasicAuth("user", getPassword())
.getForEntity("/actuator/trace", Map.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
Map<String, Object> body = entity.getBody();
Map<String, Object> trace = ((List<Map<String, Object>>) body.get("traces"))
.get(0);
Map<String, Object> map = (Map<String, Object>) ((Map<String, Object>) ((Map<String, Object>) trace
.get("info")).get("headers")).get("response");
assertThat(map.get("status")).isEqualTo("200");
}
@Test
@SuppressWarnings("unchecked")
public void traceWithParameterMap() {
this.restTemplate.withBasicAuth("user", getPassword())
.getForEntity("/actuator/health?param1=value1", String.class);
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate
.withBasicAuth("user", getPassword())
.getForEntity("/actuator/trace", Map.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
Map<String, Object> body = entity.getBody();
Map<String, Object> trace = ((List<Map<String, Object>>) body.get("traces"))
.get(0);
Map<String, Object> map = (Map<String, Object>) ((Map<String, Object>) trace
.get("info")).get("parameters");
assertThat(map.get("param1")).isNotNull();
}
@Test
public void testErrorPageDirectAccess() {
@SuppressWarnings("rawtypes")