diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/exchanges/HttpExchangesAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/exchanges/HttpExchangesAutoConfiguration.java index 5b075d27828..417465650ac 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/exchanges/HttpExchangesAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/exchanges/HttpExchangesAutoConfiguration.java @@ -51,9 +51,8 @@ public class HttpExchangesAutoConfiguration { @Bean @ConditionalOnMissingBean - HttpExchangesFilter httpExchangesFilter(HttpExchangeRepository repository, - HttpExchangesProperties traceProperties) { - return new HttpExchangesFilter(repository, traceProperties.getInclude()); + HttpExchangesFilter httpExchangesFilter(HttpExchangeRepository repository, HttpExchangesProperties properties) { + return new HttpExchangesFilter(repository, properties.getInclude()); } } @@ -65,8 +64,8 @@ public class HttpExchangesAutoConfiguration { @Bean @ConditionalOnMissingBean HttpExchangesWebFilter httpExchangesWebFilter(HttpExchangeRepository repository, - HttpExchangesProperties traceProperties) { - return new HttpExchangesWebFilter(repository, traceProperties.getInclude()); + HttpExchangesProperties properties) { + return new HttpExchangesWebFilter(repository, properties.getInclude()); } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/exchanges/HttpExchangesProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/exchanges/HttpExchangesProperties.java index 9799acb065b..85b5bb2c6a0 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/exchanges/HttpExchangesProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/exchanges/HttpExchangesProperties.java @@ -23,7 +23,7 @@ import org.springframework.boot.actuate.web.exchanges.Include; import org.springframework.boot.context.properties.ConfigurationProperties; /** - * Configuration properties for HTTP tracing. + * Configuration properties for recording HTTP exchanges. * * @author Wallace Wadge * @author Phillip Webb @@ -36,8 +36,9 @@ import org.springframework.boot.context.properties.ConfigurationProperties; public class HttpExchangesProperties { /** - * Items to be included in the trace. Defaults to request headers (excluding - * Authorization and Cookie), response headers (excluding Set-Cookie), and time taken. + * Items to be included in the exchange recording. Defaults to request headers + * (excluding Authorization and Cookie), response headers (excluding Set-Cookie), and + * time taken. */ private Set include = new HashSet<>(Include.defaultIncludes()); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/exchanges/HttpExchangesAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/exchanges/HttpExchangesAutoConfigurationTests.java index 8ca4da2257a..ea6b176ae73 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/exchanges/HttpExchangesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/exchanges/HttpExchangesAutoConfigurationTests.java @@ -104,7 +104,7 @@ class HttpExchangesAutoConfigurationTests { } @Override - public void add(HttpExchange trace) { + public void add(HttpExchange exchange) { } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/exchanges/HttpExchangesEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/exchanges/HttpExchangesEndpoint.java index 7445ad12357..698bd9905fb 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/exchanges/HttpExchangesEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/exchanges/HttpExchangesEndpoint.java @@ -36,7 +36,7 @@ public class HttpExchangesEndpoint { /** * Create a new {@link HttpExchangesEndpoint} instance. - * @param repository the trace repository + * @param repository the exchange repository */ public HttpExchangesEndpoint(HttpExchangeRepository repository) { Assert.notNull(repository, "Repository must not be null"); diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/exchanges/InMemoryHttpExchangeRepository.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/exchanges/InMemoryHttpExchangeRepository.java index b1d4831915c..367a22fe213 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/exchanges/InMemoryHttpExchangeRepository.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/exchanges/InMemoryHttpExchangeRepository.java @@ -37,7 +37,7 @@ public class InMemoryHttpExchangeRepository implements HttpExchangeRepository { private final List httpExchanges = new LinkedList<>(); /** - * Flag to say that the repository lists traces in reverse order. + * Flag to say that the repository lists exchanges in reverse order. * @param reverse flag value (default true) */ public void setReverse(boolean reverse) { @@ -64,16 +64,16 @@ public class InMemoryHttpExchangeRepository implements HttpExchangeRepository { } @Override - public void add(HttpExchange trace) { + public void add(HttpExchange exchange) { synchronized (this.httpExchanges) { while (this.httpExchanges.size() >= this.capacity) { this.httpExchanges.remove(this.reverse ? this.capacity - 1 : 0); } if (this.reverse) { - this.httpExchanges.add(0, trace); + this.httpExchanges.add(0, exchange); } else { - this.httpExchanges.add(trace); + this.httpExchanges.add(exchange); } } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/HttpExchangesEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/HttpExchangesEndpointTests.java index 76e5773c539..2f4ee56f57e 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/HttpExchangesEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/HttpExchangesEndpointTests.java @@ -44,8 +44,8 @@ class HttpExchangesEndpointTests { repository.add(HttpExchange.start(createRequest("GET")).finish(createResponse(), NO_PRINCIPAL, NO_SESSION_ID)); List httpExchanges = new HttpExchangesEndpoint(repository).httpExchanges().getExchanges(); assertThat(httpExchanges).hasSize(1); - HttpExchange trace = httpExchanges.get(0); - assertThat(trace.getRequest().getMethod()).isEqualTo("GET"); + HttpExchange exchange = httpExchanges.get(0); + assertThat(exchange.getRequest().getMethod()).isEqualTo("GET"); } private SourceHttpRequest createRequest(String method) { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/InMemoryHttpExchangeRepositoryTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/InMemoryHttpExchangeRepositoryTests.java index c78d0708694..9ba1c616f0a 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/InMemoryHttpExchangeRepositoryTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/InMemoryHttpExchangeRepositoryTests.java @@ -46,10 +46,10 @@ class InMemoryHttpExchangeRepositoryTests { this.repository.add(createHttpExchange("GET")); this.repository.add(createHttpExchange("POST")); this.repository.add(createHttpExchange("DELETE")); - List traces = this.repository.findAll(); - assertThat(traces).hasSize(2); - assertThat(traces.get(0).getRequest().getMethod()).isEqualTo("DELETE"); - assertThat(traces.get(1).getRequest().getMethod()).isEqualTo("POST"); + List exchanges = this.repository.findAll(); + assertThat(exchanges).hasSize(2); + assertThat(exchanges.get(0).getRequest().getMethod()).isEqualTo("DELETE"); + assertThat(exchanges.get(1).getRequest().getMethod()).isEqualTo("POST"); } @Test @@ -59,10 +59,10 @@ class InMemoryHttpExchangeRepositoryTests { this.repository.add(createHttpExchange("GET")); this.repository.add(createHttpExchange("POST")); this.repository.add(createHttpExchange("DELETE")); - List traces = this.repository.findAll(); - assertThat(traces).hasSize(2); - assertThat(traces.get(0).getRequest().getMethod()).isEqualTo("POST"); - assertThat(traces.get(1).getRequest().getMethod()).isEqualTo("DELETE"); + List exchanges = this.repository.findAll(); + assertThat(exchanges).hasSize(2); + assertThat(exchanges.get(0).getRequest().getMethod()).isEqualTo("POST"); + assertThat(exchanges.get(1).getRequest().getMethod()).isEqualTo("DELETE"); } private HttpExchange createHttpExchange(String method) { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/reactive/HttpExchangesWebFilterIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/reactive/HttpExchangesWebFilterIntegrationTests.java index 4261d7d05b9..8c85022c3f8 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/reactive/HttpExchangesWebFilterIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/reactive/HttpExchangesWebFilterIntegrationTests.java @@ -52,7 +52,7 @@ class HttpExchangesWebFilterIntegrationTests { .withUserConfiguration(Config.class); @Test - void traceForNotFoundResponseHas404Status() { + void exchangeForNotFoundResponseHas404Status() { this.contextRunner.run((context) -> { WebTestClient.bindToApplicationContext(context).build().get().uri("/").exchange().expectStatus() .isNotFound(); @@ -63,7 +63,7 @@ class HttpExchangesWebFilterIntegrationTests { } @Test - void traceForMonoErrorWithRuntimeExceptionHas500Status() { + void exchangeForMonoErrorWithRuntimeExceptionHas500Status() { this.contextRunner.run((context) -> { WebTestClient.bindToApplicationContext(context).build().get().uri("/mono-error").exchange().expectStatus() .isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR); @@ -74,7 +74,7 @@ class HttpExchangesWebFilterIntegrationTests { } @Test - void traceForThrownRuntimeExceptionHas500Status() { + void exchangeForThrownRuntimeExceptionHas500Status() { this.contextRunner.run((context) -> { WebTestClient.bindToApplicationContext(context).build().get().uri("/thrown").exchange().expectStatus() .isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/reactive/HttpExchangesWebFilterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/reactive/HttpExchangesWebFilterTests.java index db3bb346608..21ebc217968 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/reactive/HttpExchangesWebFilterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/reactive/HttpExchangesWebFilterTests.java @@ -49,14 +49,14 @@ class HttpExchangesWebFilterTests { EnumSet.allOf(Include.class)); @Test - void filterTracesExchange() { + void filterRecordsExchange() { executeFilter(MockServerWebExchange.from(MockServerHttpRequest.get("https://api.example.com")), (exchange) -> Mono.empty()); assertThat(this.repository.findAll()).hasSize(1); } @Test - void filterCapturesSessionIdWhenSessionIsUsed() { + void filterRecordsSessionIdWhenSessionIsUsed() { executeFilter(MockServerWebExchange.from(MockServerHttpRequest.get("https://api.example.com")), (exchange) -> exchange.getSession().doOnNext((session) -> session.getAttributes().put("a", "alpha")) .then()); @@ -67,7 +67,7 @@ class HttpExchangesWebFilterTests { } @Test - void filterDoesNotCaptureIdOfUnusedSession() { + void filterDoesNotRecordIdOfUnusedSession() { executeFilter(MockServerWebExchange.from(MockServerHttpRequest.get("https://api.example.com")), (exchange) -> exchange.getSession().then()); assertThat(this.repository.findAll()).hasSize(1); @@ -76,7 +76,7 @@ class HttpExchangesWebFilterTests { } @Test - void filterCapturesPrincipal() { + void filterRecordsPrincipal() { Principal principal = mock(Principal.class); given(principal.getName()).willReturn("alice"); executeFilter(new ServerWebExchangeDecorator( @@ -90,10 +90,10 @@ class HttpExchangesWebFilterTests { }, (exchange) -> exchange.getSession().doOnNext((session) -> session.getAttributes().put("a", "alpha")).then()); assertThat(this.repository.findAll()).hasSize(1); - org.springframework.boot.actuate.web.exchanges.HttpExchange.Principal tracedPrincipal = this.repository + org.springframework.boot.actuate.web.exchanges.HttpExchange.Principal recordedPrincipal = this.repository .findAll().get(0).getPrincipal(); - assertThat(tracedPrincipal).isNotNull(); - assertThat(tracedPrincipal.getName()).isEqualTo("alice"); + assertThat(recordedPrincipal).isNotNull(); + assertThat(recordedPrincipal.getName()).isEqualTo("alice"); } private void executeFilter(ServerWebExchange exchange, WebFilterChain chain) { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/reactive/SourceServerHttpRequestTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/reactive/SourceServerHttpRequestTests.java index 7dc907b6c4c..98c48b79d56 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/reactive/SourceServerHttpRequestTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/reactive/SourceServerHttpRequestTests.java @@ -54,16 +54,16 @@ class SourceServerHttpRequestTests { @Test void getMethod() { - SourceServerHttpRequest traceableRequest = new SourceServerHttpRequest(this.request); - assertThat(traceableRequest.getMethod()).isEqualTo("GET"); + SourceServerHttpRequest sourceRequest = new SourceServerHttpRequest(this.request); + assertThat(sourceRequest.getMethod()).isEqualTo("GET"); } @Test void getUri() { URI uri = URI.create("http://localhost:8080/"); given(this.request.getURI()).willReturn(uri); - SourceServerHttpRequest traceableRequest = new SourceServerHttpRequest(this.request); - assertThat(traceableRequest.getUri()).isSameAs(uri); + SourceServerHttpRequest sourceRequest = new SourceServerHttpRequest(this.request); + assertThat(sourceRequest.getUri()).isSameAs(uri); } @Test @@ -71,24 +71,24 @@ class SourceServerHttpRequestTests { HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.add("name", "value"); given(this.request.getHeaders()).willReturn(httpHeaders); - SourceServerHttpRequest traceableRequest = new SourceServerHttpRequest(this.request); - assertThat(traceableRequest.getHeaders()).containsOnly(entry("name", Collections.singletonList("value"))); + SourceServerHttpRequest sourceRequest = new SourceServerHttpRequest(this.request); + assertThat(sourceRequest.getHeaders()).containsOnly(entry("name", Collections.singletonList("value"))); } @Test void getUnresolvedRemoteAddress() { InetSocketAddress socketAddress = InetSocketAddress.createUnresolved("unresolved.example.com", 8080); given(this.request.getRemoteAddress()).willReturn(socketAddress); - SourceServerHttpRequest traceableRequest = new SourceServerHttpRequest(this.request); - assertThat(traceableRequest.getRemoteAddress()).isNull(); + SourceServerHttpRequest sourceRequest = new SourceServerHttpRequest(this.request); + assertThat(sourceRequest.getRemoteAddress()).isNull(); } @Test void getRemoteAddress() { InetSocketAddress socketAddress = new InetSocketAddress(0); given(this.request.getRemoteAddress()).willReturn(socketAddress); - SourceServerHttpRequest traceableRequest = new SourceServerHttpRequest(this.request); - assertThat(traceableRequest.getRemoteAddress()).isEqualTo(socketAddress.getAddress().toString()); + SourceServerHttpRequest sourceRequest = new SourceServerHttpRequest(this.request); + assertThat(sourceRequest.getRemoteAddress()).isEqualTo(socketAddress.getAddress().toString()); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/servlet/HttpExchangesFilterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/servlet/HttpExchangesFilterTests.java index 7a82abf38ba..2aef8ab0c35 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/servlet/HttpExchangesFilterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/servlet/HttpExchangesFilterTests.java @@ -56,13 +56,13 @@ class HttpExchangesFilterTests { private final HttpExchangesFilter filter = new HttpExchangesFilter(this.repository, EnumSet.allOf(Include.class)); @Test - void filterTracesExchange() throws ServletException, IOException { + void filterRecordsExchange() throws ServletException, IOException { this.filter.doFilter(new MockHttpServletRequest(), new MockHttpServletResponse(), new MockFilterChain()); assertThat(this.repository.findAll()).hasSize(1); } @Test - void filterCapturesSessionId() throws ServletException, IOException { + void filterRecordsSessionId() throws ServletException, IOException { this.filter.doFilter(new MockHttpServletRequest(), new MockHttpServletResponse(), new MockFilterChain(new HttpServlet() { @@ -80,17 +80,17 @@ class HttpExchangesFilterTests { } @Test - void filterCapturesPrincipal() throws ServletException, IOException { + void filterRecordsPrincipal() throws ServletException, IOException { MockHttpServletRequest request = new MockHttpServletRequest(); Principal principal = mock(Principal.class); given(principal.getName()).willReturn("alice"); request.setUserPrincipal(principal); this.filter.doFilter(request, new MockHttpServletResponse(), new MockFilterChain()); assertThat(this.repository.findAll()).hasSize(1); - org.springframework.boot.actuate.web.exchanges.HttpExchange.Principal tracedPrincipal = this.repository + org.springframework.boot.actuate.web.exchanges.HttpExchange.Principal recordedPrincipal = this.repository .findAll().get(0).getPrincipal(); - assertThat(tracedPrincipal).isNotNull(); - assertThat(tracedPrincipal.getName()).isEqualTo("alice"); + assertThat(recordedPrincipal).isNotNull(); + assertThat(recordedPrincipal.getName()).isEqualTo("alice"); } @Test diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/servlet/ServletSourceHttpRequestTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/servlet/ServletSourceHttpRequestTests.java index ed19e04c414..67b5fea261e 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/servlet/ServletSourceHttpRequestTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/exchanges/servlet/ServletSourceHttpRequestTests.java @@ -61,8 +61,8 @@ class ServletSourceHttpRequestTests { } private void validate(String expectedUri) { - ServletSourceHttpRequest trace = new ServletSourceHttpRequest(this.request); - assertThat(trace.getUri().toString()).isEqualTo(expectedUri); + ServletSourceHttpRequest sourceRequest = new ServletSourceHttpRequest(this.request); + assertThat(sourceRequest.getUri().toString()).isEqualTo(expectedUri); } }