Rename httptrace endpoint and related classes to httpexchanges

Rename `/actuator/httptrace` to `/actuator/httpexchanges` to better
describe its purpose and to remove confusion with distribute tracing.

This change also takes the opportunity to improve the code by making
the `HttpExchange` class (previously `HttpTrace`) fully immutable.

Closes gh-32885

Co-authored-by: Andy Wilkinson <wilkinsona@vmware.com>
This commit is contained in:
Phillip Webb
2022-10-26 15:48:59 -07:00
parent 26d61b9295
commit 3e50836b1a
54 changed files with 1639 additions and 1642 deletions

View File

@@ -27,7 +27,7 @@ include::actuator/tracing.adoc[]
include::actuator/auditing.adoc[]
include::actuator/http-tracing.adoc[]
include::actuator/http-exchanges.adoc[]
include::actuator/process-monitoring.adoc[]

View File

@@ -44,9 +44,9 @@ The following technology-agnostic endpoints are available:
| `health`
| Shows application health information.
| `httptrace`
| Displays HTTP trace information (by default, the last 100 HTTP request-response exchanges).
Requires an `HttpTraceRepository` bean.
| `httpexchanges`
| Displays HTTP exchange information (by default, the last 100 HTTP request-response exchanges).
Requires an `HttpExchangeRepository` bean.
| `info`
| Displays arbitrary application info.

View File

@@ -0,0 +1,17 @@
[[actuator.http-exchanges]]
== Recording HTTP Exchanges
You can enable recording of HTTP exchanges by providing a bean of type `HttpExchangeRepository` in your application's configuration.
For convenience, Spring Boot offers `InMemoryHttpExchangeRepository`, which, by default, stores the last 100 request-response exchanges.
`InMemoryHttpExchangeRepository` is limited compared to tracing solutions, and we recommend using it only for development environments.
For production environments, we recommend using a production-ready tracing or observability solution, such as Zipkin or OpenTelemetry.
Alternatively, you can create your own `HttpExchangeRepository`.
You can use the `httpexchanges` endpoint to obtain information about the request-response exchanges that are stored in the `HttpExchangeRepository`.
[[actuator.http-exchanges.custom]]
=== Custom HTTP Exchange Recording
To customize the items that are included in each recorded exchange, use the configprop:management.httpexchanges.include[] configuration property.
To disable recoding entirely, set configprop:management.httpexchanges.record[] to `false`.

View File

@@ -1,16 +0,0 @@
[[actuator.tracing]]
== HTTP Tracing
You can enable HTTP Tracing by providing a bean of type `HttpTraceRepository` in your application's configuration.
For convenience, Spring Boot offers `InMemoryHttpTraceRepository`, which stores traces for the last 100 (the default) request-response exchanges.
`InMemoryHttpTraceRepository` is limited compared to other tracing solutions, and we recommend using it only for development environments.
For production environments, we recommend using a production-ready tracing or observability solution, such as Zipkin or Spring Cloud Sleuth.
Alternatively, you can create your own `HttpTraceRepository`.
You can use the `httptrace` endpoint to obtain information about the request-response exchanges that are stored in the `HttpTraceRepository`.
[[actuator.tracing.custom]]
=== Custom HTTP Tracing
To customize the items that are included in each trace, use the configprop:management.trace.http.include[] configuration property.
For advanced customization, consider registering your own `HttpExchangeTracer` implementation.

View File

@@ -1011,3 +1011,5 @@ data.nosql.elasticsearch.connecting-using-rest.webclient=data.nosql.elasticsearc
# Spring Boot 2.7 - 3.0 migrations
getting-started.first-application.code.enable-auto-configuration=getting-started.first-application.code.spring-boot-application
actuator.tracing=actuator.http-exchanges
actuator.tracing.custom=actuator.http-exchanges.custom

View File

@@ -210,7 +210,7 @@ When it does so, the orders shown in the following table will be used:
| `WebFilterChainProxy` (Spring Security)
| `-100`
| `HttpTraceWebFilter`
| `HttpExchangesWebFilter`
| `Ordered.LOWEST_PRECEDENCE - 10`
|===