Commit Graph

612 Commits

Author SHA1 Message Date
Christian Laakmann 24ca44dbb4 Fix Elasticsearch health indicator
- added setIndices to ElasticsearchHealthIndicatorProperties to enable
  setting the indices property from configuration files
- Elasticsearch cannot handle "null" if the health of all indices should
  be checked; use "_all" instead

Closes gh-2812
2015-04-13 16:48:58 +01:00
Stephane Nicoll bbaaaeb9cf Merge branch '1.2.x' 2015-04-13 12:30:27 +02:00
Stephane Nicoll 08959286e2 Fix "keys-to-sanitize" property doc 2015-04-13 12:28:34 +02:00
Sergey Egorov a60df81845 Add additional MetricsMvcEndpoint regex tests
Update MetricsMvcEndpointTests to test for regular expression based
calls.

Closes gh-2252
2015-04-09 18:15:20 -07:00
Phillip Webb 8ca5635b69 Add regex support to /metrics and /env endpoints
Update MetricsMvcEndpoint and EnvironmentMvcEndpoint to support regex
filter of names.

See gh-2252
Add it
2015-04-09 18:13:43 -07:00
Phillip Webb ffc5d565c8 Merge branch '1.2.x' 2015-04-09 10:47:08 -07:00
Phillip Webb e94de70358 Polish 2015-04-09 10:42:53 -07:00
Andy Wilkinson ba3d4e9e3c Upgrade to Spring Security 4
This commit updates Spring Boot to use Spring Security 4. As a result
of this, the coordinates of Thmyeleaf's Spring Security extra, for
which dependency management and auto-configuration is provided, have
been updated to the Spring Security 4 variant.

Closes gh-2727
2015-04-09 13:55:02 +01:00
Andy Wilkinson d3c70fa198 Merge branch '1.2.x' 2015-04-09 13:33:32 +01:00
Dave Syer 8cdff1cf70 Fix bug in trace repository
When reverse==false we have to be careful to remove the right element
when capacity is reached.
2015-04-09 13:11:59 +01:00
Dave Syer 76ca00fa0d Merge branch '1.2.x' (trace repository reverse) 2015-04-09 12:05:20 +01:00
Dave Syer 8ef21b31ad Add flag to TraceRepository to reverse order of listing
Default to true (so existing apps change their behaviour, but that
seems to be the majority vote).

Fixes gh-2794
2015-04-09 12:04:19 +01:00
Andy Wilkinson 03b109a2c8 Polish Elasticsearch health indicator
- Nest the configuration class in HealthIndicatorAutoConfiguration,
   bringing it into line with the other health indicator configuration
   classes
 - Include the statistics from the response in the health’s details
 - Map YELLOW to UP rather than UNKNOWN as it indicates that the cluster
   is running but that “the primary shard is allocated but replicas are
   not” [1]. The details can be used to determine the precise state of
   the cluster.
 - Add a property to configure the time that the health indicator will
   wait to receive a response from the cluster
 - Document the configuration properties
 - Update the tests to cover the updated functionality

See gh-2399

[1] http://www.elastic.co/guide/en/elasticsearch/reference/1.x/cluster-health.html
2015-04-09 10:16:32 +01:00
Binwei Yang 58c8c2ccdc Add a health indicator for an Elasticsearch cluster
Closes gh-2399
2015-04-08 17:18:40 +01:00
Andy Wilkinson bbaf585dd0 Merge branch '1.2.x' 2015-04-08 11:33:05 +01:00
Andy Wilkinson 83f842a226 Reinstate support for relaxed binding for endpoint enablement
This commit improves upon the changes made in a8bf9d3 by adding
support for relaxed binding of the endpoints.enabled and
endpoints.<name>.enabled properties. This is achieved by replacing
use of @ConditionalOnExpression (which does not support relaxed
binding) with a custom condition implementation that uses
RelaxedPropertyResolver.

Closes gh-2767
2015-04-08 11:29:41 +01:00
Andy Wilkinson 5e3aab5153 Merge branch '1.2.x' 2015-04-07 17:43:12 +01:00
Andy Wilkinson a8bf9d34d5 Honour endpoint.enabled:false for nested paths
Previously, only invocations of /metricName/ would honour the enabled
property and return a not found (404) response. For endpoints which
support nested paths, access to /metricName/foo would ignore the enabled
flag and return an OK (200) response. Furthermore, there was a comment
in EndpointMvcAdapter that suggested that an endpoint shouldn’t be
called when it is disabled, however this was not the case.

This commit updates EndpointWebMvcAutoConfiguration and
JolokiaAutoConfiguration to only register their MvcEndpoint beans if
the underlying endpoint is enabled. This means that an
EndpointMvcAdapter should not be called if its delegate is disabled,
making the comment described above accurate.

The check for the delegate being enabled has been retained so as not to
rely upon the auto-configurations’ behaviour. The methods which handle
nested paths (MetricsMvcEndpoint.value() and
EnvironmentMvcEndpoint.value()) have been updated to add the same check
for the enablement of their delegate.

Fixes gh-2767
2015-04-07 17:43:02 +01:00
Phillip Webb 718a090b32 Restore Java 6 source/target settings
Update spring-boot-actuator to restore Java 6 compatibility.
2015-04-06 20:30:37 -07:00
Phillip Webb 8143d1f36d Apply animal sniffer to entire build
Move animal sniffer configuration out of spring-boot-dependencies to
spring-boot-parent and apply it to all projects.

See gh-716
2015-04-06 19:47:22 -07:00
Dave Syer c9c1e8b517 Add animal sniffer for Java 6 and jdk1.8 to actuator
The build now requires java 8 (although no language features are yet
in use). Bamboo has been updated.

Fixes gh-716
2015-04-06 08:54:43 +01:00
Spring Buildmaster e03c11dda8 Next development version 2015-03-30 22:56:20 -07:00
Phillip Webb fbf34e261e Polish 2015-03-30 10:37:02 -07:00
Andy Wilkinson becbc00a4d Use configured ObjectMapper, if available, in all EndpointMBeans
Prior to this commit, every EndpointMBean used its own ObjectMapper.
Each of these ObjectMappers was created using new ObjectMapper() with
no opportunity for configuration.

This commit uses the ObjectMapper from the application context and
shares it among all EndpointMBeans. This gives the user control over
the ObjectMapper’s configuration using spring.jackson.* properties,
their own Jackson2ObjectMapperBuilder bean, etc. In the absence of an
ObjectMapper in the application context a single ObjectMapper is
instantiated and is used by all EndpointMBeans instead.

To allow the ObjectMapper to be shared, a number of constructors have
been overloaded to also take the ObjectMapper as a parameter. In these
cases the old constructor has been preserved for backwards compatibility
but has been deprecated.

Closes gh-2393
2015-03-30 17:40:19 +01:00
Andy Wilkinson 8850286937 List excluded auto-config classes in the auto-config report and endpoint
Prior to this commit, the auto-configuration report (both in its logged
form and the actuator endpoint) listed the positive and negative matches
but did not list the classes, if any, that the user had excluded.

This commit updates the logged report and the actuator endpoint to
expose a list of the excluded class names configured via the exclude
attribute on @EnableAutoConfiguration.

Closes gh-2085
2015-03-30 16:23:34 +01:00
Andy Wilkinson ee3521b6a2 Test that total space is included in disk health information
Closes gh-2705
2015-03-30 13:41:39 +01:00
izeye e270a21b82 Add total space to disk health information
Previously, disk health information only included the amount of free
space and the configured threshold. This commit adds the disk’s total
space.

See gh-2705
2015-03-30 13:41:23 +01:00
Phillip Webb 10da3d390e Polish 2015-03-27 11:30:58 -07:00
Stephane Nicoll f5023fd415 Use testConnection() method
Update MailHealthIndicator to use the new testConnection() method
available as of Spring Framework 4.2

Closes gh-2666
2015-03-27 16:56:39 +01:00
Phillip Webb 7d3465f858 Merge branch '1.2.x' 2015-03-24 18:05:43 -07:00
Phillip Webb 4c50c9eaa8 Allow basic SystemPublicMetrics on GAE
Update SystemPublicMetrics to silently ignore ManagementFactory
NoClassDefFoundErrors which can occur when deploying to Google App
Engine.

Fixes gh-2701
2015-03-24 13:56:12 -07:00
Stephane Nicoll 9820fa9c88 Remove dead code
Fixes gh-2686
2015-03-21 16:50:58 +01:00
Andy Wilkinson ebf68978e8 Merge branch '1.2.x' 2015-03-19 17:17:05 +00:00
Andy Wilkinson c1eea4cf40 Ensure that a TTL of zero is honoured by HealthMvcEndpoint
See gh-2630
2015-03-19 17:16:08 +00:00
Andy Wilkinson 3b979eb828 Merge branch '1.2.x' 2015-03-19 16:23:29 +00:00
Andy Wilkinson c849a0aba1 Cache /health response irrespective of sensitivity and security
Previously, the response from /health was not cached if the request
was secure, i.e. the user has authenticated, or the endpoint was
configured as not being sensitive. 

The commit updates HealthMvcEndpoint to apply the caching logic
all the time. Users that do not want caching can disable it by 
configuring the TTL with a value of zero.

Closes gh-2630
2015-03-19 16:23:04 +00:00
Andy Wilkinson 8d89f8fcea Merge branch '1.2.x' 2015-03-18 11:18:53 +00:00
Andy Wilkinson 8b20403c41 Use a String when referencing a class with @ConditionalOnMissingClass
Using a Class reference can cause reflection problems at runtime (see
gh-1065).

Closes gh-2674
2015-03-18 11:16:58 +00:00
Phillip Webb 182754a582 Polish HealthIndicatorAutoConfiguration
Update HealthIndicatorAutoConfiguration to reduce the amount of
duplication in inner configuration classes.
2015-03-16 17:38:24 -07:00
Phillip Webb 4af70f1840 Polish 2015-03-16 16:26:53 -07:00
Phillip Webb c349b402e8 Merge branch '1.2.x' 2015-03-16 14:32:31 -07:00
Phillip Webb 16495d223a Polish 2015-03-16 14:11:43 -07:00
Stephane Nicoll bfee98e1f3 Add JMS health indicator
Define an additional health indicator for each ConnectionFactory instance
defined in the context. Extracts the provider name from the connection
meta-data.

Fixes gh-2016
2015-03-10 13:38:19 +01:00
Stephane Nicoll 9094706f6a polish 2015-03-10 13:37:37 +01:00
Johannes Stelzer cd8c3d7327 Add mail health check
Define an additional health indicator for each JavaMailSenderImpl
instance in the context.

Closes gh-2017 and gh-2617
2015-03-10 10:17:33 +01:00
Andy Wilkinson 6811a41817 Merge branch '1.2.x' 2015-03-05 11:08:12 +00:00
Andy Wilkinson 743482ab69 Tolerate Gauges with non-Number values
Spring Boot's metrics infrastructure requires a Metric to have a
Number value. Coda Hale's ThreadStatesGaugeSet includes a Gauge
named deadlocks with a Set<String> value (each entry in the set is a
description, including stacktrace, of a deadlocked thread). There's
no obvious way to coerce this to a Number, and there's already a
deadlocks.count metric in the set.

This commit updates MetricRegistryMetricReader to ignore the addition
of any Gauge with a non-Number value.

Fixes gh-2593
2015-03-05 11:07:58 +00:00
Andy Wilkinson af5de18bf3 Merge branch '1.2.x' 2015-03-04 15:24:35 +00:00
Andy Wilkinson 4487823ff9 Improve thread-safety of MetricRegistryMetricReader
ee567fa boldy claimed that it had made MetricRegistryMetricReader
thread-safe. It had not. This commit should actually make it thread
safe. I hope.

One notable improvement is that MetricRegistryMetricReader.findAll()
will no longer contain null values if a metric is removed on another
thread during iteration.

names is now a ConcurrentHashMap to allow it to be safely read and
written without holding a lock.

reverse is a LinkedMultiValueMap  which is not thread-safe. This could
lead to values being lost when concurrent add calls were made. Access
to reverse is now protected by synchronizing on an internal monitor
object.

Calls to containsKey(key) followed by get(key) have been reworked to
only call get(key), this avoids the possibility of the key being
removed after the contains check but before the get.

Closes gh-2590
2015-03-04 15:03:03 +00:00
Andy Wilkinson 3ce45c0bab Merge branch '1.2.x' 2015-03-03 16:54:47 +00:00