This commit adds more information to the ElasticSearch REST
health indicator.
When the ES instance responds with an error HTTP status,
the health details now include the actual status code and reason phrase.
When the ES instance returns a HTTP 200 response, the entire response
map is used as health details.
See gh-15366
This commit adds `ElasticsearchRestHealthIndicator`, a new
`HealthIndicator` for Elasticsearch, using the Elasticsearch "low level
rest client" provided by the
`"org.elasticsearch.client:elasticsearch-rest-client"` dependency.
Note that Spring Boot will auto-configure both low and high level REST
clients, but since the high level one is using the former, a single
health indicator will cover both cases.
See gh-15211
This commit changes the requested endpoint for the Jest
HealthIndicator. The `"/_all/_stats"` was previously used, but
the response size can be quite large and costly.
This is now using the `"/_cluster/health"` endpoint.
Previously, when using Tomcat, a call to mappings endpoint would force
the initialization of any DispatcherServlets in the context. This was
done by calling allocate on Tomcat's StandardWrapper. This left the
wrapper in a state that would cause it to block for two seconds during
shutdown as the wrapper has an outstanding allocation.
This commit immediately deallocates the servlet after it has been
allocated. This ensures that the DispatcherServlet has been initialized
while also leaving the wrapper in a state that it can shut down
immediately when asked to do so.
Closes gh-14898
SPR-17395 ensures that WebFlux.fn is adding a request attribute of type
`PathPattern` on the `HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE`.
A specific tag provider for WebFlux.fn is no longer necessary.
See gh-14876
Update `WebEndpointDiscoverer` and related classes to that multiple
`PathMapper` beans can be registered. Mappers are now tried in order
until one returns a non-null value.
Closes gh-14841
Previously, Couchbase's health was determined by retrieving the bucket info
from the cluster info. This retrieval could take over one minute in some
cases even when Couchbase is health. This latency is too large for a health
check.
The Couchbase team have recommended the of a Cluster#diagnostics instead.
This provides a much lower latency view of the cluster's health. This
commit updates CouchbaseHealthIndicator to use Cluster#diagnostics while
retaining support, in a deprecated form, for the old info-based mechanism
should anyone want to opt back into that in 2.0.x.
Closes gh-14685
Update `ExposeExcludePropertyEndpointFilter` so that mixed case
endpoint IDs are supported. Prior to this commit it was not easy for
an endpoint to be missed by the filter due to the formatting of the
property value.
See gh-14773
Update the endpoint time-to-live binding logic so that mixed case
endpoint IDs are supported. Prior to this commit an
`InvalidConfigurationPropertyNameException` would be thrown when using
a camel case endpoint ID.
See gh-14773
Add an `EndpointID` class to enforce the naming rules that we support
for actuator endpoints. We now ensure that all endpoint names contain
only letters and numbers and must begin with a lower-case letter.
Existing public classes and interfaces have been changes so that String
based `endpointId` methods are deprecated and strongly typed versions
are preferred instead. A few public classes that we're not expecting
to be used directly have been changed without deprecated methods being
introduced.
See gh-14773
Update `MetricsEndpoint` so that only the first matching meter is used
when calculating the sum of of statistics.
Prior this this commit the endpoint would consider all Meters. This
caused incorrect statistics when multiple back-end systems were being
used since the registries contained in the `CompositeMeterRegistry`
would be iterated, and the same effective metric would be counted more
than once.
Closes gh-14497
Previously, the API required to create HttpTrace instances was
package-private. This made it difficult to implement an
HttpTraceRepository that persists the HttpTrace instances
rather than holding them in memory as it inhibited recreation of the
instances when they read from the persistent store.
This commit adds public constructors to HttpTrace and related classes
to enable recreation of an HttpTrace. The package-private methods for
mutating properties have not been made public to ensure that the
public API remains immutable.
Closes gh-14726
Previously, if the call to connection.start() hung, JmsHealthIndicator
would also hang and then never respond.
This commit introduces the use of an additional thread that waits for
up to 5 seconds for the connection to start. If the call to start
does not complete within that time, the connection is closed. The
call to close causes the call to start to throw an exception, thereby
stopping the hang and allowing the indicator to report that the
broker is down.
Closes gh-10809
Rework Prometheus push gateway support so that the central class can
be used outside of auto-configuration. The shutdown flags have also
been replaced with a single "shutdown-operation" property since it's
unlikely that both "push" and "delete" will be required.
It's also possible now to supply a `TaskScheduler` to the manager.
See gh-14353
This commit aligns SessionsEndpoint with
FindByIndexNameSessionRepository API improvements that simplifies
retrieval of sessions by principal name.
Closes gh-14124
This commit changes AbstractWebMvcEndpointHandlerMapping to
be a MatchableHandlerMapping. Additionally, EndpointRequest,
now delegates to MvcRequestMatcher for Spring MVC applications.
For all other applications, AntPathRequestMatcher is used as
a delegate.
Closes gh-13962
This commit makes sure to use a configurable timeout to check if the
Couchbase cluster is up, rather than relying on the default that can be
quite long.
Closes gh-13879
Previously, the setter of a property whose second letter is upper-case (
such as `oAuth2Uri`) was not detected properly. The JavaBean spec states
that, in such a case, the first letter should not be capitalized (i.e.
the setter should be `setoAuth2Uri` rather than `setOAuth2Uri`).
This commit makes sure that Jackson uses standard bean names and fixes
the setter detection algorithm to take this case into account.
Closes gh-13878
Add an `DispatcherServletPath` interface which provides a much more
consistent way to discover the path of the main dispatcher servet.
Prior to this commit, auto-configurations would often make use of the
`ServerProperties` class to discover the dispatcher servlet path. This
mechanism isn't very explicit and also makes it hard for us to relocate
that property in Spring Boot 2.1.
This commit also reverts most of fddc9e9c7e since it is now clear that
the supporting multiple dispatcher servlet paths will be much more
involved that we originally anticipated.
Closes gh-13834
Previously, when a DispatcherServlet was registered via a
ServletRegistrationBean, the mappings endpoint did not expose any
information about it as it wasn't detected.
This commit fixes the detection of available DispatcherServlets in the
context so that the mappings endpoint include them all.
Closes gh-13186
This commit improves the for Actuator Metrics in WebClient.
Unlike the server couterpart of WebFlux, using a `retry` operator on a
`WebClient` pipeline does resubscribes to the whole chain.
The previous implementation recorded start time at the time of pipeline
build phase, but outside of it. This doesn't work since retrying the
same pipeline doesn't update the recorded start time and the duration of
sequential calls are cumulative.
This is now fixed using the Reactor `Context`, since we're now recording
the start time at subscription time and record metrics on `onNext` and
`onError` signals.
Closes gh-12228
Previously, a NullPointerException would occur when WebFluxTags
attempted to create a method Tag for a request with a non-standard
method.
This commit updates WebFluxTags to use getMethodValue(), which will
never return null, rather than getMethod(), which may return null,
when determining the tag's value for the given request.
Closes gh-13596
As of Spring Framework 5.1, we're depending on the Reactor Californium
release train.
Reactor Netty is now at version 0.8 and changed its artifact
coordinates, package names and broke several APIs. Spring Framework is
now up-to-date with those changes and this commit does the same for
Spring Boot.
Note that in that process, the `NettyServerCustomizer` has been changed
since the former `HttpServerOptions.Builder` API is now gone from
Reactor Netty, and we're now relying on immutable server instances
instead of a stateful builder pattern.
See gh-13321
Previously, WebMvcTags would fall back to using the request’s path
info if Spring MVC’s best matching path pattern attribute was not
available. For non-Spring MVC web frameworks that support path
variables, such as Jersey, this led to an explosion of URI tags that
could exhaust the heap.
Closes gh-12447
This commit fixes endpoint extension discovery when the related endpoint
is sub-classed. Previously, a strict by type check was applied against
the `endpoint` attribute of `EndpointExtension`.
Rather than using a `Class` check, this commit extracts the id of an
endpoint and uses it to match its extension, if any.
Closes gh-13082
This commit improves the `health` endpoint to run health check for a
particular component or, if that component is itself a composite, an
instance of that component.
Concretely, it is now possible to issue a `GET` on
`/actuator/health/{component}` and
`/actuator/health/{component}/instance` to retrieve the health of a
component or an instance of a composite component, respectively.
If details cannot be showed for the current user, any request leads to a
404 and does not invoke the health check at all.
Closes gh-8865
This commit updates the initial proposal to add support for reactive
use cases as well. A reactive application can use
ReactiveHealthIndicatorRegistry as an alternative to
HealthIndicatorRegistry.
Closes gh-4965
This commit introduces HealthIndicatorRegistry which handles
registration of HealthIndicator instances. Registering new
HealthIndicator instances is now possible in runtime.
See gh-4965
This commit improves the initial proposal by providing a by name read
operation that returns the detail of a particular cache. It also adds
more tests and complete API documentation for the feature.
Closes gh-12216
This commits adds an actuator endpoint which lists the caches per
context and cacheManager and provides a delete operation to clear the
caches. As the statistics are exposed via the metrics endpoint they are
not included
See gh-12216
This commit adds support for Actuator Metrics for WebClient.
This support mirrors the current behavior for `RestTemplate`, reusing
the same metric name `"http.client.requests"` and tags.
`WebClient` is instrumented by a `MetricsWebClientFilterFunction` which
is applied by a `WebClientCustomizer`. This instrumentation happens
automatically only if you create an instance of `WebClient` using an
auto-configured `WebClient.Builder` bean.
This infrastructure is reusing de facto the `MeterFilter` that has been
added for `RestTemplate` in order to limit the "uri" tag cardinality.
Closes gh-12228
This commit makes sure to respect the MBeanServer#invoke contract by
wrapping any user-defined exception in an MBeanException. Also, any
exception not from the JDK is translated, as it may lead to unexpected
issue on the client if that class isn't present. This is consistent
with our operation result mapping strategy.
Closes gh-10448
As pointed out by Rossen in gh-11514 comments, a handler might commit
the response and then send an error signal in the pipeline. In this
case, adding a callback to `beforeCommit` is useless because it won't be
triggered. In those cases, we need to collect metrics right away.
Spring Boot now deploys both annotation-based and functional endpoints
under the same `HttpHandler`; this means the currently auto-configured
`MetricsWebFilter` is instrumenting all endpoints to produce metrics.
There is no need for a WebFlux functional specific support.
This commit removes mentions of `RouterFunctionMetrics` in the docs and
deprecates that class.
Closes gh-12833
Prior to this commit, the metrics `WebFilter` would handle exceptions
flowing through the pipeline and extract tag information right away.
Since error handling turns the exception information into error HTTP
responses later in the chain, the information extracted from the
response earlier is invalid.
In this case, the "status" information could be "200" whereas error
handlers would later set that status to "500".
This commit delays the tags extraction later in the process, right
before the response is comitted. The happy path is not changed, as
handlers signal that the response is fully taken care of at that point.
Fixes gh-11514
Previously to this commit, if a `@ControllerEndpoint`,
`@RestControllerEndpoint` or `@ServletEndpoint` annotated bean was
proxied, the endpoint wasn't properly detected.
This commit makes sure that annotation retrieval works on the user class
while preserving the get (vs. find) retrieval semantic
Closes gh-12441
This commit ensures that `WebFluxTags` not only relies on
`BEST_MATCHING_PATTERN_ATTRIBUTE` or request URI to provide the "uri"
tag information.
To avoid cardinality explosion, HTTP not found and redirects are
assigned fixed uri tags.
Closes gh-12685
Prior to this commit, `WebMvcTags' would always mark as "NOT_FOUND" or
"REDIRECTION" *any* exchange with responses of 404 and 3xx status, even
if those responses are actually returned by Controller handlers.
This commit checks inverts those checks and first considers if the
"BEST_MATCHING_PATTERN_ATTRIBUTE" request attribute is present and uses
it - then falls back to "NOT_FOUND" and "REDIRECTION" to avoid
cardinality explosion.
Fixes gh-12577
Create a new `ApplicationConversionService` similar in design to the
DefaultFormattingConversionService from Spring Framework. The new
conversion service provides a central place for custom conversion logic
supported by Spring Boot.
Also replace the `BindingConversionService` with an internal
`BindConverter` class that now invokes the `SimpleTypeConverter`
directly. Binding for `@ConfigurationProperties` has been updated so
that any custom property editors registered with the BeanFactory can
be used.
Fixes gh-12095
Move leading slash logic from `MetricsClientHttpRequestInterceptor` to
`RestTemplateExchangeTags` so that URI based calls are also managed.
Closes gh-12126
Previously, if a controll endpoint included a mapping with no path,
it would be mapped to the root of the application rather than the
root of the endpoint's path.
This commit updates the handler mappings for both reactive and Servlet
web applications to treat a mapping with no paths as being a mapping
with a single empty path. This ensures that a path with the endpoint's
path prepended is used for the mapping.
Closes gh-12104
Remove custom `SpringIntegrationMetrics` and instead provide
auto-configuration to the direct Micrometer support added in Spring
Integration 5.0.2.
Closes gh-11985
Previously, links were only provide to web endpoints. This commit
expands link resolution to also provide links for servlet endpoints,
controller endpoints, and rest controller endpoints.
Closes gh-11902
Update `GitProperties` so that the `commit.id` entry is also copied to
`commit.id.full`.
Prior to this commit, when returning full details, the value of
`commit.id` would be replaced with a `Map` containing only `abbriv` as
a key. By copying the value to a sub-key we ensure that it remains
available both in the FULL and SIMPLE modes.
Fixes gh-11892