Prior to this commit, exceptions nested in
`NestedServletExceptions` would not be recorded by the
`WebMvcMetricsFilter`. This commit ensures that exceptions
happening downstream (e.g. happening while writing the response
body itself) are properly recorded.
See https://github.com/micrometer-metrics/micrometer/issues/1190
See gh-16014
Update the `BaseConfiguration` class in `ScheduledTasksEndpointTests`
to be package private so that it can be enhanced by cglib.
Prior to merge commit 361437f4 the class was a lite configuration so
it didn't matter that it was a private class.
loadOnStartup property was missing from EndpointServlet and cannot be set
inside ServletEndpointRegistrar. Now it can be set and register a Servlet
with that integer property ready to act upon registration.
See gh-16053
When Spring Security is misconfigured it's possible to switch from an anonymous user
to a normal user. When switching back again, the corresponding
AuthenticationSwitchUserEvent will have a null target user. Previously, Actuator's
AuthenticationAuditListener would throw a NullPointerException when it received such an
event.
This commit updates the audit listener to defensively handled events with a null target
user.
Closes gh-15767
Prior to this commit, the `HttpTraceWebFilter` would collect the
response information (status and headers) for tracing purposes, after
the handling chain is done with the exchange - inside a
`doAfterSuccessOrError`.
Once the handler has processed the exchange, there is no strong
guarantee about the HTTP resources being still present. Depending on the
web server implementation, HTTP resources (including HTTP header maps)
might be recycled, because pooled in the first place.
This commit moves the collection and processing of the HTTP trace right
before the response is committed. This removes the need to handle
special cases with exceptions, since by that time all exception handlers
have processed the response and the information that we extract is the
information that's about to be written to the network.
Fixes gh-15819
This commit aligns the Spring WebFlux instrumentation on Spring MVC
since gh-12447.
From now on, if the best matching path pattern is not found,
the recorded uri tag will be "UNKNOWN".
Note that for WebFlux.fn, the pattern information is properly
recorded as of SPR-17395.
Closes gh-15609
Similar to what's ben done in gh-15420 for Spring MVC and Spring
WebFlux, this commit adds an outcome tag for the client side on both
`RestTemplate` and `WebClient`.
See gh-15594
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