Commit Graph

1039 Commits (5b74d464a61503b77d1f5765eb9d52f7ff9598c4)

Author SHA1 Message Date
Andy Wilkinson accc1f1ca8 Merge branch '2.2.x' into 2.3.x
Closes gh-22410
4 years ago
Andy Wilkinson 21f733b89b Merge branch '2.1.x' into 2.2.x
Closes gh-22409
4 years ago
Andy Wilkinson 179d2c79d6 Avoid trivialising what the reader's learning about
Closes gh-22408
4 years ago
Andy Wilkinson cb7f99ad72 Polish "Measure with nanoseconds in HttpExchangeTracer"
See gh-22266
4 years ago
dreis2211 d72f5139f1 Measure with nanoseconds in HttpExchangeTracer
See gh-22266
4 years ago
Brian Clozel 3f93978e99 Merge branch '2.3.x'
Closes gh-22215
4 years ago
Brian Clozel 86d8366ee2 Polish support for reactive Elasticsearch healthcheck
Fixes gh-21042
4 years ago
Aleksander Lech 203878a16f Add support for reactive Elasticsearch healthcheck
Prior to this commit, configuring a reactive Elasticsearch client would
auto-configure an Actuator Health check using a synchronous client, with
the default configuration properties (so tarting localhost:9200).

This would lead to false reports of unhealthy Elasticsearch clusters
when using reactive clients.

This commit reproduces the logic for MongoDB repositories: if a reactive
variant is available, it is selected for the health check
infrastructure.

See gh-21042
4 years ago
Andy Wilkinson 4ea07f432d Merge branch '2.3.x'
Closes gh-22168
4 years ago
Andy Wilkinson 75fc140e2d Merge branch '2.2.x' into 2.3.x
Closes gh-22167
4 years ago
Andy Wilkinson 3922fb7164 Polish "Avoid NPE when binder is closed before started event"
See gh-22141
4 years ago
im47cn b34c268547 Avoid NPE when binder is closed before started event
Previously, if TomcatMetricsBinder destroy() was called before it had
received an ApplicationStartedEvent an NPE would be thrown due to
TomcatMetrics being null. This NPE was then caught and logged at
warning level by the disposable bean adapter.

This prevents the NPE by checking that the TomcatMetrics instance is
null before calling close() on it.

See gh-22141
4 years ago
Andy Wilkinson fe78be240a Merge branch '2.3.x'
Closes gh-22103
4 years ago
Andy Wilkinson a2f7ce0564 Merge branch '2.2.x' into 2.3.x
Closes gh-22102
4 years ago
Andy Wilkinson 5475f10657 Remove WebClient's in-memory buffer size limit for endpoint tests
Previously, the thread dump endpoint's response could exceed
WebClient's in-memory buffer limt when there were a large number of
threads or the threads had large stacks.

This commit disables WebClient's in-memory buffer size limit so that
the test passing is not dependent on the number of active threads and
their stack sizes.

Closes gh-22101
4 years ago
Scott Frederick 3b587449a6 Provide cluster info in RedisReactiveHealthIndicator
This commit changes the information provided by
RedisReactiveHealthIndicator to include cluster details when Spring
Data Redis detects that Redis is running in a clustered configuration.
This brings the reactive and non-reactive Redis health indicators
into alignment.

Fixes gh-21514
4 years ago
Scott Frederick dba8ca2848 Merge branch '2.3.x'
Closes gh-22095
4 years ago
Scott Frederick 72f37c41fb Merge branch '2.2.x' into 2.3.x
Fixes gh-22061 in 2.3.2
4 years ago
Scott Frederick b27303704f Fix RedisReactiveHealthIndicator in clustered configuration
Prior to Spring Data Redis version 2.2.8, the contents of the
Properties object returned from the
ReactiveRedisConnection.ServerCommands.info API were the same
for clustered and non-clustered Redis configurations, containing a set
of key/value pairs. This allowed ReactiveRedisHealthIndicator to get
a version property using a well-known key. Starting with Spring Data
Redis 2.2.8, the info property keys contain a host:port prefix in a
clustered Redis configuration. This prevented
ReactiveRedisHealthIndicator from getting the version property as
before and resulted in the health always being reported as DOWN.

This commit adjusts ReactiveRedisHealthIndicator to detect the
clustered configuration from Spring Data Redis and find the version
property for one of the reported cluster nodes.

Fixes gh-22061
4 years ago
Andy Wilkinson 0d6ea79007 Start building against Spring Framework 5.3.0 snapshots
See gh-21929
4 years ago
Stephane Nicoll f0f8424191 Merge branch '2.3.x'
Closes gh-22008
4 years ago
dreis2211 855d596c2a Use lazy lambda instead of explicit argument
See gh-21986
4 years ago
Andy Wilkinson 9e08490522 Merge branch 'gh-21271'
Closes gh-21271
4 years ago
Andy Wilkinson 9636350b0b Enable rawtypes compilation warnings
See gh-21271
4 years ago
Andy Wilkinson 056d5f3120 Enable deprecation compilation warnings
See gh-21271
4 years ago
Andy Wilkinson c64649a6d9 Enable unchecked compilation warnings
See gh-21271
4 years ago
Andy Wilkinson 07fb4b065d Merge branch '2.3.x'
Closes gh-21940
4 years ago
Andy Wilkinson 0de466e06e Require dependency on s-b-dependencies to use its constraints
Previously, Spring Boot's modules published Gradle Module Metadata
(GMM) the declared a platform dependency on spring-boot-dependencies.
This provided versions for each module's own dependencies but also had
they unwanted side-effect of pulling in spring-boot-dependencies
constraints which would influence the version of other dependencies
declared in the same configuration. This was undesirable as users
should be able to opt in to this level of dependency management, either
by using the dependency management plugin or by using Gradle's built-in
support via a platform dependency on spring-boot-dependencies.

This commit reworks how Spring Boot's build uses
spring-boot-dependencies and spring-boot-parent to provide its own
dependency management. Configurations that aren't seen by consumers are
configured to extend a dependencyManagement configuration that has an
enforced platform dependency on spring-boot-parent. This enforces
spring-boot-parent's version constraints on Spring Boot's build without
making them visible to consumers. To ensure that the versions that
Spring Boot has been built against are visible to consumers, the
Maven publication that produces pom files and GMM for the published
modules is configured to use the resolved versions from the module's
runtime classpath.

Fixes gh-21911
4 years ago
Stephane Nicoll e87c3193ce Polish "Add Java 15 CI"
See gh-21713
4 years ago
dreis2211 cf3cd0be48 Use Class.getName() as fallback in HandlerFunctionDescription
In JDK 15 the concept of hidden classes was introduced, which also
affects Lambdas in so far that Class.getCanonicalName() will return null
for those. This commit uses Class.getName() as a fallback when no
canonical name is available.

See gh-21713
4 years ago
Stephane Nicoll 35e069e2cd Polish "Add health indicator for Cassandra that uses the CqlSession"
See gh-20887
4 years ago
Alexandre Dutra dad9ec86d5 Add health indicator for Cassandra that uses the CqlSession
This commit provides a CassandraDriverHealthIndicator and
CassandraDriverReactiveHealthIndicator that do not require Spring Data.
As a result, a health indicator for Cassandra is provided even if the
application does not use Spring Data.

See gh-20887
4 years ago
Stephane Nicoll 554971d29b Merge branch '2.3.x'
Closes gh-21917
4 years ago
Stephane Nicoll ee250e058a Merge branch '2.2.x' into 2.3.x
Closes gh-21916
4 years ago
Stephane Nicoll ec8c1e3860 Update copyright year of changed files
See gh-21906
4 years ago
lltx de897b9b72 Fix wrong property reference to keys-to-sanitize in Javadoc
See gh-21906
4 years ago
Phillip Webb 16b1d64b43 Merge branch '2.3.x'
Closes gh-21764
5 years ago
dreis2211 eeb1db2176 Use supplier assertions in availability indicator
See gh-21758
5 years ago
Phillip Webb 8a7a5929ae Merge branch '2.3.x' 5 years ago
Phillip Webb cc50605687 Merge branch '2.2.x' into 2.3.x 5 years ago
Phillip Webb 0a05b4c9fd Update copyright year of changed files 5 years ago
Johnny Lim cd1baf18fe Support filtered scrape for Prometheus
See gh-21545
5 years ago
Andy Wilkinson daeca9f332 Restore Boot 2.2's compile-scoped dependencies
Fixes gh-21507
5 years ago
Stephane Nicoll 1d2d76b051 Merge branch '2.2.x'
Closes gh-21560
5 years ago
Stephane Nicoll afcb5d54b2 Polish "Fix uri tag for empty path"
See gh-21392
5 years ago
Jon Schneider f78f2d57e1 Fix uri tag for empty path
See gh-21392
5 years ago
Phillip Webb fd505e516f Merge branch '2.2.x'
Closes gh-21444
5 years ago
Phillip Webb 49a21ded7a Create endpoint beans as late as possible
Update `EndpointDiscoverer` so that `@Endpoint` and `@EndpointExtension`
beans are created as late as possible.

Prior to this commit, endpoint beans and extension beans would be
created during the discovery phase which could cause early bean
initialization. The problem was especially nasty when using an embedded
servlet container since `ServletEndpointRegistrar` is loaded as the
container is initialized. This would trigger discovery and load all
endpoint beans, including the health endpoint, and all health indicator
beans.

Fixes gh-20714
5 years ago
Phillip Webb 038ae93406 Update copyright year of changed files 5 years ago
Scott Frederick a30740f8d2 Separate server properties for message and errors
Prior to this commit, there was a property server.error.include-details
that allowed configuration of the message and errors attributes in a
server error response.

This commit separates the control of the message and errors attributes
into two separate properties named server.error.include-message and
server.error.include-binding-errors. When the message attribute is
excluded from a servlet response, the value is changed from a
hard-coded text value to an empty value.

Fixes gh-20505
5 years ago
Stephane Nicoll ee913503b4 Tolerate Hazelcast 4
This commit updates HazelcastHealthIndicator and
HazelcastCacheMeterBinderProvider so that they work with
Hazelcast 4 while retaining compatibility with Hazelcast 3. Reflection
is used when necessary.

This commit also adds a smoke test that validates those features are
working when Hazelcast 4 is on the classpath.

Closes gh-21169
5 years ago
Brian Clozel ec871d6752 Fix StatusAggregator static initialization
Prior to this commit, there was a cycle between `StatusAggregator` and
`SimpleStatusAggregator`, which caused a static initialization bug -
depending on which class (the implementation or its interface) was
loaded first.

This commit turns the static field of the `StatusAggregator` interface
into a static method to avoid this problem.

Fixes gh-21211
5 years ago
dreis2211 5eb5bf0a2d Polish
See gh-21009
5 years ago
Stephane Nicoll 85e9f713b0 Update copyright year of changed files
See gh-21007
5 years ago
Johnny Lim 29717423a3 Remove this keyword on member method invocations
See gh-21007
5 years ago
Phillip Webb 56711d678a Merge branch '2.2.x'
Closes gh-21083
5 years ago
Phillip Webb 102729b5e1 Merge branch '2.1.x' into 2.2.x
Closes gh-21082
5 years ago
Phillip Webb b3d33754a5 Remove outdated FIXMEs from tests
Closes gh-19782
5 years ago
Phillip Webb bf41da5322 Update copyright year of changed files 5 years ago
Scott Frederick 70d4994502 Disable exception details on default error views
Prior to this commit, default error responses included the message
from a handled exception. When the exception was a BindException, the
error responses could also include an errors attribute containing the
details of the binding failure. These details could leak information
about the application.

This commit removes the exception message and binding errors detail
from error responses by default, and introduces a
`server.error.include-details` property that can be used to cause
these details to be included in the response.

Fixes gh-20505
5 years ago
dreis2211 b0eea26260 Prevent shaded imports from Datastax
See gh-20967
5 years ago
Phillip Webb 5311c04437 Change HealthEndpointGroups customization support
Update the `HealthEndpointGroups` customization support to use a
post-processor rather than a mutable registry. Although this approach
is slightly less flexible, it removes a lot of complexity from the
`HealthEndpointGroups` code. Specifically, it allows us to drop the
`HealthEndpointGroupsRegistry` interface entirely.

The probe health groups are now added via the post-processor if they
aren't already defined. Unlike the previous implementation, users are
no longer able to customize status aggregation and http status code
mapping rules _unless_ they also re-define the health indicators that
are members of the group.

See gh-20962
5 years ago
Phillip Webb 82cfd7c6c9 Restructure probes auto-configuration
Relocate probe auto-configuration from the `kubernetes` package to
`availability` since probes could also be used on other platforms.

The classes have also been renamed to named to `AvailabilityProbes...`

See gh-20962
5 years ago
Phillip Webb 71e4801e68 Rename probe health indicators
Rename `LivenessProbeHealthIndicator` to `LivenessStateHealthIndicator`
and `ReadinessProbeHealthIndicator` to `ReadinessStateHealthIndicator`.

Also introduce a general purpose `AvailabilityStateHealthIndicator`
class.

See gh-20962
5 years ago
Phillip Webb bb79c847b2 Allow custom availability states
Create a general purpose `AvailabilityState` interface and refactor
the existing `LivenessState` and `ReadinessState` to use it. A single
`AvailabilityChangeEvent` is now used to carry all availability state
updates.

This commit also renames `ApplicationAvailabilityProvider` to
`ApplicationAvailabilityBean` and extracts an `ApplicationAvailability`
interface that other beans can inject. The helps to hide the event
listener method, which is really internal.

Finally the state enums have been renamed as follows:

 - `LivenessState.LIVE` -> `LivenessState.CORRECT`
 - `ReadinessState.READY` -> `ReadinessState.ACCEPTING_TRAFFIC`
 - `ReadinessState.UNREADY` -> `ReadinessState.REFUSING_TRAFFIC`

See gh-20962
5 years ago
Phillip Webb 1604cb2a1e Polish 5 years ago
dreis2211 4b9986d790 Remove unused fields in tests
See gh-20926
5 years ago
Brian Clozel ce653059c8 Improve recording of cancellation signal in WebClient
With its initial fix in gh-18444, the `WebClient` instrumentation would
record all CANCEL signals, including:

* when a `timeout` expires and the response has not been received
* when the client partially consumes the response body

Since the second use case is arguable intentional, this commit restricts
the instrumentation and thus avoids recording two events for a single
request in that case.

Closes gh-18444
5 years ago
Brian Clozel 3879a7505c Record cancelled client requests in WebClient
Prior to this commit, cancelled client requests (for example as a result
of a `timeout()` reactor operator would not be recorded by Micrometer.

This commit instruments the cancelled signal for outgoing client
requests and assigns a status `CLIENT_ERROR`.
The cancellation can be intentional (triggering a timeout and falling
back on a faster alternative) or considered as an error. The intent
cannot be derived from the signal itself so we're considering it as a
client error.

Closes gh-18444
5 years ago
Phillip Webb 3ca896e63f Polish 5 years ago
Phillip Webb 5d8d0bb159 Update copyright year of changed files 5 years ago
Andy Wilkinson f238812cea Polish "Improve handling of non-existent path in disk space health check"
See gh-20580
5 years ago
Andreas Born db565cfc3a Improve handling of non-existent path in disk space health check
See gh-20580
5 years ago
Stephane Nicoll ef592eaed8 Merge branch '2.2.x'
Closes gh-20726
5 years ago
Stephane Nicoll ac56db703e Merge branch '2.1.x' into 2.2.x
Closes gh-20725
5 years ago
Stephane Nicoll 88b7b78344 Make sure that cassandra health check reports version
Closes gh-20719
5 years ago
Stephane Nicoll a7e8829560 Polish 5 years ago
Stephane Nicoll 5ad4de184d Merge branch '2.2.x'
Closes gh-20718
5 years ago
Stephane Nicoll 05f10819c4 Merge branch '2.1.x' into 2.2.x
Closes gh-20717
5 years ago
Stephane Nicoll c9e32aaa47 Use LOCAL_ONE when querying system.local
This commit is a follow-up of gh-20709 to apply the same consistency
level to the Cassandra reactive health indicator.

Closes gh-20713
5 years ago
Stephane Nicoll 876371e0fd Merge branch '2.2.x'
Closes gh-20712
5 years ago
Stephane Nicoll a9a6df2ed4 Merge branch '2.1.x' into 2.2.x
Closes gh-20711
5 years ago
Stephane Nicoll 63be1678de Polish "Use LOCAL_ONE when querying system.local"
See gh-20709
5 years ago
Alexandre Dutra 851f631eac Use LOCAL_ONE when querying system.local
The system keyspace has a replication factor of 1 and is local to each
node; it is therefore recommended to query system.local with a
consistency level of ONE or LOCAL_ONE.

Stronger consistency levels may result in an Unavailable error, but this
does not mean that the node is down.

See gh-20709
5 years ago
dreis2211 674f1e77b5 Fix typos
See gh-20704
5 years ago
Brian Clozel eb70fd952f Turn LivenessState and ReadinessState into enums
Prior to this commit, `LivenessState` and `ReadinessState` were
immutable classes. This was done in order to have additional behavior
and information in those classes.

Because the current implementation doesn't need this, this commit turns
those classes into simple enums.
Additional state and information can be added to the
`*StateChangedEvent` classes.

See gh-19593
5 years ago
dreis2211 25f48cb289 Fix typos in HealthEndpointGroupConfigurer
See gh-20628
5 years ago
Phillip Webb 0717de723f Polish 5 years ago
Phillip Webb 9a33a723fe Update copyright year of changed files 5 years ago
Phillip Webb 16b5ea3414 Update copyright year of changed files 5 years ago
dreis2211 ef9f1d39a3 Remove redundant MockitoAnnotations.initMocks()
See gh-20601
5 years ago
Stephane Nicoll 70aa788747 Merge branch '2.2.x'
Closes gh-20600
5 years ago
Stephane Nicoll 8593270b5b Only remove trailing slash from URI value
This commit upgrades the algorithm when trailing slash are to be
ignored. Previously a root URI (i.e. "/") would result to to empty
string which is an issue for monitoring system that requires tag values
to be non empty. If the URI is a single character, the trailing is not
applied and "/" is left as is.

Closes gh-20536
5 years ago
Brian Clozel ffdf9a422f Polish Liveness and Readiness support
This commit moves the core Liveness and Readiness support to its own
`availability` package. We've made this a core concept independent of
Kubernetes.

Spring Boot now produces `LivenessStateChanged` and
`ReadinessStateChanged` events as part of the typical application
lifecycle.

Liveness and Readiness Probes (`HealthIndicator` components and health
groups) are still configured only when deployed on Kubernetes.

This commit also improves the documentation around Probes best practices
and container lifecycle considerations.

See gh-19593
5 years ago
Brian Clozel fd0b2f6695 Add Kubernetes Liveness and Readiness Probes support
Prior to this commit and as of Spring Boot 2.2.0, we would advise
developers to use the Actuator health groups to define custom "liveness"
and "readiness" groups and configure them with subsets of existing
health indicators.

This commit addresses several limitations with that approach.

First, `LivenessState` and `ReadinessState` are promoted to first class
concepts in Spring Boot applications. These states should not only based
on periodic health checks. Applications should be able to track changes
(and adapt their behavior) or update states (when an error happens).

The `ApplicationStateProvider` can be injected and used by applications
components to get the current application state. Components can also
track specific `ApplicationEvent` to be notified of changes, like
`ReadinessStateChangedEvent` and `LivenessStateChangedEvent`.
Components can also publish such events with an
`ApplicationEventPublisher`. Spring Boot will track startup event and
application context state to update the liveness and readiness state of
the application. This infrastructure is available in the
main spring-boot module.

If Spring Boot Actuator is on the classpath, additional
`HealthIndicator` will be contributed to the application:
`"LivenessProveHealthIndicator"` and `"ReadinessProbeHealthIndicator"`.
Also, "liveness" and "readiness" Health groups will be defined if
they're not configured already.

Closes gh-19593
5 years ago
Brian Clozel b680db6cd8 Add HealthEndpointGroupsRegistry and its Customizer
Prior to this commit, `HealthContributor` would be exposed under the
main `HealthEndpoint` and subgroups, `HealthEndpointGroups`. Groups are
driven by configuration properties and there was no way to contribute
programmatically new groups.

This commit introduces the `HealthEndpointGroupsRegistry` (a mutable
version of `HealthEndpointGroups`) and a
`HealthEndpointGroupsRegistryCustomizer`. This allows configurations to
add/remove groups during Actuator auto-configuration.

Closes gh-20554
5 years ago
Stephane Nicoll abe43b2e83 Upgrade to Couchbase SDK v3
This commit upgrades to the Couchbase SDK v3 which brings the following
breaking changes:

* Bootstrap hosts have been replaced by a connection string and the
authentication is now mandatory.
* A `Bucket` is no longer auto-configured. The
`spring.couchbase.bucket.*` properties have been removed
* `ClusterInfo` no longer exists and has been replaced by a dedicated
API on `Cluster`.
* `CouchbaseEnvironment` no longer exist in favour of
`ClusterEnvironment`, the customizer has been renamed accordingly.
* The bootstrap-related properties have been removed. Users requiring
custom ports should supply the seed nodes and initialize a Cluster
themselves.
* The endpoints-related configuration has been consolidated in a
single IO configuration.

The Spring Data Couchbase provides an integration with the new SDK. This
leads to the following changes:

* A convenient `CouchbaseClientFactory` is auto-configured.
* Repositories are configured against a bucket and a scope. Those can
be set via configuration in `spring.data.couchbase.*`.
* The default consistency property has been removed in favour of a more
flexible annotation on the repository query methods instead. You can now
specify different query consistency on a per method basis.
* The `CacheManager` implementation is provided, as do other stores for
consistency so a dependency on `couchbase-spring-cache` is no longer
required.

See gh-19893

Co-authored-by: Michael Nitschinger <michael@nitschinger.at>
5 years ago
dreis2211 3e24df3beb Fix method order checkstyle issue
See gh-20525
5 years ago
Andy Wilkinson 0315724126 Cache endpoint responses on a per-principal basis
Previously, any HTTP request to an endpoint that included a principal
would bypass the cache. This prevented authenticated requests from
making use of the cache and its configurable time-to-live.

This commit updates the caching operation invoker to include the
principal, if any, in its cache key. As a result, requests that
include a principal will make use of the cache, potentially returning
the result of a previous invocation of the same endpoint by the same
principal.

Closes gh-19538
5 years ago
Andy Wilkinson ef9960c69f Allow additional tags to be contributed to WebMvc and WebFlux defaults
Closes gh-20175
5 years ago