Disable HttpTrace infrastructure by default

Prior to this commit, the http trace auto-configuration provided
an `InMemoryHttpTraceRepository` bean. This commit changes the auto-config
so that an `HttpTraceRepository` is not provided and instead the auto-config
is conditional on the presence of a `HttpTraceRepository` bean. This is done
to encourage the use of a custom implementation of `HttpTraceRepository`
since the in-memory one is quite limited and not suitable for production.
A flag is available if the auto-configuration needs to be turned off even
in the presence of a bean.

Closes gh-15039
This commit is contained in:
Madhura Bhave
2019-05-03 11:46:12 -07:00
parent fc9cd86718
commit de128fed20
4 changed files with 48 additions and 69 deletions

View File

@@ -2213,8 +2213,12 @@ implementing `ApplicationEventPublisherAware`).
[[production-ready-http-tracing]]
== HTTP Tracing
Tracing is automatically enabled for all HTTP requests. You can view the `httptrace`
endpoint and obtain basic information about the last 100 request-response exchanges.
HTTP Tracing can be enabled by providing a bean of type `HttpTraceRepository` in your application's
configuration. For convenience, Spring Boot offers an `InMemoryHttpTraceRepository` that stores traces
for the last 100 request-response exchanges, by default. `InMemoryHttpTraceRepository` is limited
compared to other tracing solutions and we recommend using it only for development environments.
For production environments, consider creating your own alternative `HttpTraceRepository` implementation.
You can view the `httptrace` endpoint and obtain information about the request-response exchanges.
@@ -2224,11 +2228,6 @@ To customize the items that are included in each trace, use the
`management.trace.http.include` configuration property. For advanced customization,
consider registering your own `HttpExchangeTracer` implementation.
By default, an `InMemoryHttpTraceRepository` that stores traces for the last 100
request-response exchanges is used. If you need to expand the capacity, you can define
your own instance of the `InMemoryHttpTraceRepository` bean. You can also create your own
alternative `HttpTraceRepository` implementation.
[[production-ready-process-monitoring]]